The Python code to reproduce the illustrations from The Hundred-Page Machine Learning Book.
WARNING! To avoid buying counterfeit on Amazon, click on See All Buying Options and choose "Amazon.com" and not a third-party seller.
The Python code to reproduce the illustrations from The Hundred-Page Machine Learning Book.
Home Page: http://themlbook.com
License: MIT License
The Python code to reproduce the illustrations from The Hundred-Page Machine Learning Book.
WARNING! To avoid buying counterfeit on Amazon, click on See All Buying Options and choose "Amazon.com" and not a third-party seller.
Hi,
I was wondering if you will be interested to improve the running time of prediction strenght file. I did some tests and it takes so long. I can volunteer to optimized it
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.
Hello, I have installed all the Software Libraries required, and removed the header (the first line of Advertising.csv), removed the ids (the first column of Advertising.csv), and then replaced the comas by tabs (real tabs, not 2/4/8 spaces). However, I still failed in running it.
PS C:\Users\DELL> & C:/Users/DELL/AppData/Local/Programs/Python/Python36/python.exe "e:/Work/2020-Summer/other/Research Project/Report/ML/from future import print_function.py"
epoch: 0 loss: 92.32078294903626
w, b: 0.7412639000000002 0.028045000000000007
Traceback (most recent call last):
File "e:/Work/2020-Summer/other/Research Project/Report/ML/from future import print_function.py", line 74, in
w, b = train(x, y, 0.0, 0.0, 0.001, 15000)
File "e:/Work/2020-Summer/other/Research Project/Report/ML/from future import print_function.py", line 60, in train
fig1.savefig('../../Illustrations/gradient_descent-' + str(image_counter) + '.eps', format='eps', dpi=1000, bbox_inches = 'tight', pad_inches = 0)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\matplotlib\figure.py", line 2203, in savefig
self.canvas.print_figure(fname, **kwargs)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\matplotlib\backend_bases.py", line 2126, in print_figure
**kwargs)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\matplotlib\backends\backend_ps.py", line 831, in print_eps
return self._print_ps(outfile, 'eps', *args, **kwargs)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\matplotlib\backends\backend_ps.py", line 851, in _print_ps
orientation, papertype, **kwargs)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\matplotlib\cbook\deprecation.py", line 358, in wrapper
return func(*args, **kwargs)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\site-packages\matplotlib\backends\backend_ps.py", line 1076, in _print_figure
with open(outfile, 'w', encoding='latin-1') as fh:
FileNotFoundError: [Errno 2] No such file or directory: '../../Illustrations/gradient_descent-2.eps'
PS C:\Users\DELL>
How to solve this problem.
Thank you very much.
plz provide data.txt file
The book and the repository are very useful Andriy, thanks for all your work.
I was reviewing this repo and at first sight, I felt some examples might not run due to hardcoded paths.
For example https://github.com/aburkov/theMLbook/blob/master/kmeans.py#L125
This directory might not be present.
We can probably assign an illustration directory within this repo.
It would be very helpful to list all the packages needed for this specific repository. It makes it easy to install with a pip list for beginners.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.