ageron / ageron/handson-ml2

[Chapter 3] - p102 - Scaling and using SGD Classifier

Abierto
#167 2 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Jupyter Notebook
Estrellas
30k
Forks
13.1k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hi,

I am currently on p.102 Chapter 3 and I have just scaled the training data of the MNIST dataset using the StandardScalar(). After scaling the training data, it doesn't seem that the SGD model is refitted using this newly scaled data. Instead, the data is scaled and then y_train_pred (y train predictions) are made calling the SGD classifier (fitted to the X_train unscaled data) onto the X_train_scaled data. Is this the correct way to scale and use data in models? I ask as my 1st thought is that you would need to refit the model on the scaled data as it is very different to the original data. That way when you feed the scaled data to the model it will have been fitted on the scaled data and not the original data.

I have run a cross validation on both:

1. an SGD model using the scaled trained X data as input but fitted to the original data
2. an SGD model using the scaled trained X data as input AND fitted to the scaled data

1. 5 fold cross valid results = array([0.89733333, 0.88725 , 0.89583333, 0.89233333, 0.90516667])
2. 5 fold cross valid results = array([0.89733333, 0.88725 , 0.89583333, 0.89233333, 0.90516667])

As you can see when you fit the model to the scaled data and then use the scaled data it performs exactly the same as the case when you don't re fit the model / re train the model. Is this always the case / do you not need to re fit the model once you have rescaled?

Any help would be much appreciated.

Thanks,
Dan

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.