BinRoot / TensorFlow-Book

Accompanying source code for Machine Learning with TensorFlow. Refer to the book for step-by-step explanations.
http://www.tensorflowbook.com
MIT License
4.45k stars 1.21k forks source link

A mistake in Concept01 in Chapter04 #6

Closed zhbzz2007 closed 7 years ago

zhbzz2007 commented 7 years ago

I am reading TensorFlow-Book/ch04_classification/Concept01_linear_regression_classification.ipynb , I find a mistake.

In your description

Let's say we have numbers that we want to classify. They'll just be 1-dimensional values. Numbers close to 2 will be given the label [0], and numbers close to 5 will be given the label [1], as designed here:

but in your code,

x_label0 = np.random.normal(5, 1, 10)
x_label1 = np.random.normal(2, 1, 10)
print x_label0
print x_label1
xs = np.append(x_label0, x_label1)
labels = [0.] * len(x_label0) + [1.] * len(x_label1)

we can find you give Numbers close to 2 is label [1], and numbers close to 5 is label [0].

Maybe you need fix this mistake.

BinRoot commented 7 years ago

Thank you! Fixed! 4f96d49