nfmcclure / tensorflow_cookbook

Code for Tensorflow Machine Learning Cookbook
https://www.packtpub.com/big-data-and-business-intelligence/tensorflow-machine-learning-cookbook-second-edition
MIT License
6.24k stars 2.41k forks source link

Suggestion for cleaner normalization implementation #117

Open ychong opened 6 years ago

ychong commented 6 years ago

Hi,

If it's not too much, I have a suggestion for a cleaner implementation of x_vals normalization.

Instead of defining a separate function, and since the objective of normalization is just to allow for faster convergence, we could perform the following:

x_vals_train = x_vals_train / x_vals_train.max(axis=0) x_vals_test = x_vals_test / x_vals_test.max(axis=0)

This implementation is cleaner and achieve similar loss results. Do let me know what you think.

Sincerely, Yi Xiang chongyixiang@gmail.com

nfmcclure commented 6 years ago

I'll look into this. Thanks!