-
Notifications
You must be signed in to change notification settings - Fork 589
Open
Description
Hi,
I tried running gradient_descent.py.
But it failed.
$ python gradient_descent.py
Traceback (most recent call last):
File "gradient_descent.py", line 73, in <module>
x, y = np.loadtxt("data.txt", delimiter= "\t", unpack = True)
File "/Users/fujisho/.pyenv/versions/3.7.4/lib/python3.7/site-packages/numpy/lib/npyio.py", line 1146, in loadtxt
for x in read_data(_loadtxt_chunksize):
File "/Users/fujisho/.pyenv/versions/3.7.4/lib/python3.7/site-packages/numpy/lib/npyio.py", line 1074, in read_data
items = [conv(val) for (conv, val) in zip(converters, vals)]
File "/Users/fujisho/.pyenv/versions/3.7.4/lib/python3.7/site-packages/numpy/lib/npyio.py", line 1074, in <listcomp>
items = [conv(val) for (conv, val) in zip(converters, vals)]
File "/Users/fujisho/.pyenv/versions/3.7.4/lib/python3.7/site-packages/numpy/lib/npyio.py", line 781, in floatconv
return float(x)
ValueError: could not convert string to float: 'The dataset for gradient descent example can be downloaded from: http://themlbook.com/wiki/doku.php?id=gradient_descent'I downloaded the CSV pointed in data.txt and loaded it instead of it, but it didn't work as well:
$ python gradient_descent.py
Traceback (most recent call last):
File "gradient_descent.py", line 73, in <module>
x, y = np.loadtxt("Advertising.csv", delimiter= "\t", unpack = True)
File "/Users/fujisho/.pyenv/versions/3.7.4/lib/python3.7/site-packages/numpy/lib/npyio.py", line 1146, in loadtxt
for x in read_data(_loadtxt_chunksize):
File "/Users/fujisho/.pyenv/versions/3.7.4/lib/python3.7/site-packages/numpy/lib/npyio.py", line 1074, in read_data
items = [conv(val) for (conv, val) in zip(converters, vals)]
File "/Users/fujisho/.pyenv/versions/3.7.4/lib/python3.7/site-packages/numpy/lib/npyio.py", line 1074, in <listcomp>
items = [conv(val) for (conv, val) in zip(converters, vals)]
File "/Users/fujisho/.pyenv/versions/3.7.4/lib/python3.7/site-packages/numpy/lib/npyio.py", line 781, in floatconv
return float(x)
ValueError: could not convert string to float: ',TV,radio,newspaper,sales'
It would be helpful if you can provide any tips to solve the problem.
Metadata
Metadata
Assignees
Labels
No labels