luisguiserrano / manning Goto Github PK
View Code? Open in Web Editor NEWRepository for the book Grokking Machine Learning, by Manning Editors
Repository for the book Grokking Machine Learning, by Manning Editors
In the notebook, you have:
def perceptron_trick(weights, bias, features, label, learning_rate = 0.01):
pred = prediction(weights, bias, features)
for i in range(len(weights)):
weights[i] += (label-pred)*features[i]*learning_rate
bias += (label-pred)*learning_rate
return weights, bias
but in the book, the bias is not done for each iteration of the loop:
def perceptron_trick(weights, bias, features, label, learning_rate = 0.01):
pred = prediction(weights, bias, features)
for i in range(len(weights)):
weights[i] += (label-pred)*features[i]*learning_rate
bias += (label-pred)*learning_rate
return weights, bias
Unfortunately, this leads to different numbers than those that are published in the book
The python files depend on turicreate , but this is not available natively on Windows.
For example running : Naive Bayes.ipynb gives you ModuleNotFoundError: No module named 'turicreate' but when you try to install via conda or pip -it fails ,as no support natively exists for windows 10 .
In the second definition of linear_regressin
of this block, it reads
def linear_regression(features, labels, learning_rate=0.01, epochs = 1000):
price_per_room = random.random()
base_price = random.random()
errors = []
for i in range(epochs):
predictions = features[0]*price_per_room+base_price
errors.append(rmse(labels, predictions))
i = random.randint(0, len(features)-1)
I suppose the predictions should be calculated on all features instead of just the fixed first feature.
predictions = features[0]*price_per_room+base_price
This makes predictions a scalar instead of a vector. Then, the following rmse
makes no sense.
Should it be like this?
predictions = features*price_per_room+base_price
Hi
I've found some typos in your book:
On Pg 50, you have writren:
Case 3: If the price of the house is lower than the price the model predicted, and the number
of rooms is positive:
• Add 1 cent to the price per room
• Subtract 1 cent to the base price.
However, in case 3, the number of rooms is negative.
For context, take a look at this image https://imgur.com/a/NT5szwl
Simple_trick is not offered as an option in the first linear regression function. In the second linear regression function, it is called, but the arguments is incorrect (no learning rate).
An alternative would be to write the following code
plt.scatter(features,labels) plt.show()
Hi @luisguiserrano,
I recently started reading GML, which is excellent, and wanted to run some of the examples however I am having issues getting them running on a new Macbook Pro with an M1 chip. I am using pyenv, poetry, and a terminal with Rosetta to try and install TuriCreate but am having no luck. Please let me know what other info you need to help with this issue.
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
above lines are needed to run on Macbook for "A graphical example", and possibly need to install xgboost as well...
hi Luis, one stupid question, which python version are these exercises written? I keep having issues with py3.6.13. Many Thanks
Guan
Was going through the code in the Ensemble chapter.
It appears sklearn externals six is going to be deprecated and eventually removed. Recommend installing "six" : https://pypi.org/project/six/ and the code will change from:
from sklearn.externals.six import StringIO
to:
from six import StringIO
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.