nfmcclure / tensorflow_cookbook

Code for Tensorflow Machine Learning Cookbook

Home Page:https://www.packtpub.com/big-data-and-business-intelligence/tensorflow-machine-learning-cookbook-second-edition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Confuse of The Result Of 06_Neural_Networks/07_Improving_Linear_Regression/

huang10086 opened this issue · comments

When I copy the code of 06_Neural_Networks/07_Improving_Linear_Regression/ and run on my computer(ubuntu16 with tensorflow 1.1 CPU),the loss as follows:"
Loss = -39.0416
Loss = -79.6343
Loss = -117.884
Loss = -147.927
Loss = -183.015
Loss = -212.834
Loss = -258.794
Loss = -282.107
Loss = -307.925
Loss = -351.318"
That made me confused,wish you give me some suggestion,thanks!

I think that the column of birth-weight data is different. It should change the target in this example.
The data in my case is as following,
2017-12-05 4 20 46
so I change the y target to x[0] and x_vals to x[1:8]

# Pull out target variable
y_vals = np.array([x[0] for x in birth_data])
# Pull out predictor variables (not id, not target, and not birthweight)
x_vals = np.array([x[1:8] for x in birth_data])

I think it will be the minimal change to reproduce the result,thought the loss and accuracy may be a little different.

Thank you very much,I run the code by your way and get a right result!

commented

Hi @huang10086 , sorry about the late reply, I'm just now able to get around to triaging the issues now in preparation for a v2 of the code.

Thanks, @T-rain for the fix.

Indeed, the site that hosted the original birthweight data closed it's doors to the public, forcing me to find and host a different version of the data. I wasn't able to verify that they were the same, and indeed they are not. The target is the 0-th column and the features are columns 1-8.

I'll be updating the code in the next few months and expect it to be fixed then.

Hi @nfmcclure ,thanks for your reply!This cookbook gives me a lot of help in ML.

commented

The code should finally be updated, sorry about the delay. Thanks!