rasbt / machine-learning-book

Code Repository for Machine Learning with PyTorch and Scikit-Learn
https://sebastianraschka.com/books/#machine-learning-with-pytorch-and-scikit-learn
MIT License
3.63k stars 1.31k forks source link

Ch12, when standard the train data #134

Open JPL-JUNO opened 1 year ago

JPL-JUNO commented 1 year ago

X_train_norm = (X_train - np.mean(X_train)) / np.std(X_train) use the mean and std of whole dataset. I think the correct way is to use mean and std of each column, X_train_norm = (X_train - np.mean(X_train, axis=0)) / np.std(X_train, axis=0) https://github.com/rasbt/machine-learning-book/blob/92e2320709071b4dcc82a99552aec145536cfbcd/ch12/ch12_part2.py#L239 (forgive my poor English)

rasbt commented 1 year ago

You are totally right, thanks for the note! (cc @haydenliu )