rasbt / python-machine-learning-book-3rd-edition

The "Python Machine Learning (3rd edition)" book code repository
https://www.amazon.com/Python-Machine-Learning-scikit-learn-TensorFlow/dp/1789955750/
MIT License
4.55k stars 1.96k forks source link

updating self.random with np.random #137

Closed RakeshJarupula closed 3 years ago

RakeshJarupula commented 3 years ago

there was a typo(self.random.shuffle and self.random.normal) in the neural networks MLP code.

rasbt commented 3 years ago

Thanks for the PR, but this is intentional, not a typo. The self in self.random.shuffle corresponds to

self.random = np.random.RandomState(seed)

in the constructor. If you change it to np.random.shuffle, the random seed in

    def __init__(self, n_hidden=30,
                 l2=0., epochs=100, eta=0.001,
                 shuffle=True, minibatch_size=1, seed=None):

won't have any effect. Please let me know if you have any questions about this.

RakeshJarupula commented 3 years ago

Thanks you sir, for your explanation :). Your book is awesome.

rasbt commented 3 years ago

Glad the explanation made sense, and thanks for the kind words :)