dafriedman97 / mlbook Goto Github PK
View Code? Open in Web Editor NEWRepository for the free online book Machine Learning from Scratch (link below!)
Home Page: https://dafriedman97.github.io/mlbook/content/introduction.html
License: MIT License
Repository for the free online book Machine Learning from Scratch (link below!)
Home Page: https://dafriedman97.github.io/mlbook/content/introduction.html
License: MIT License
In the Math section of the Appendix, the numerator of the derivative of f(x) = g(x)/h(x) should be subtraction not addition.
h(x).g'(x) + g(x).h'(x) => h(x).g'(x) - g(x).h'(x)
Nice work Daniel.
I found a typo at line 60 of https://dafriedman97.github.io/mlbook/content/conventions_notation.html, where your second "is written as
The title is the description
Please add a license to facilitate contributions and distribution.
Congratulations on a releasing the well structured book! Neat use of Jupyter book!
I thought of use of no-constructor classes in your code - good for combining methods together,
but not really a great pattern for starting programming - not to replicate when a learner just starts writing Python code.
class LinearRegression:
def fit(self, X, y, intercept = False):
# record data and dimensions
if intercept == False: # add intercept (if not already included)
ones = np.ones(len(X)).reshape(len(X), 1) # column of ones
X = np.concatenate((ones, X), axis = 1)
self.X = np.array(X)
self.y = np.array(y)
self.N, self.D = self.X.shape
# estimate parameters
XtX = np.dot(self.X.T, self.X)
XtX_inverse = np.linalg.inv(XtX)
Xty = np.dot(self.X.T, self.y)
self.beta_hats = np.dot(XtX_inverse, Xty)
# make in-sample predictions
self.y_hat = np.dot(self.X, self.beta_hats)
# calculate loss
self.L = .5*np.sum((self.y - self.y_hat)**2)
I understand this is an idiom throughout the book, but if you consider restructuring the code at some point,
there can be a more functional representation:
# estimate parameters
XtX = np.dot(self.X.T, self.X)
XtX_inverse = np.linalg.inv(XtX)
Xty = np.dot(self.X.T, self.y)
self.beta_hats = np.dot(XtX_inverse, Xty)
def estimate_betas(X,Y):
XtX = np.dot(X.T, X)
XtX_inverse = np.linalg.inv(XtX)
Xty = np.dot(X.T, Y)
return np.dot(XtX_inverse, Xty)
Hi,
I read your eBook on Machine Learning which very well explains everything about linear regression, neural networks etc. It's really helpful.
I however had a question on the neural network implementation in Python (https://dafriedman97.github.io/mlbook/content/c7/construction.html).
For simplicity, the model has only 1 layer between input and output as stated in the beginning of the text.
What about the following line in the code then? -> ffnn.fit(X_boston_train, y_boston_train, n_hidden = 8)
n_hidden is set at 8. Can you exaggerate on this? What does n_hidden mean exactly and why is it set at 8 in this example?
Kind regards,
Matthias
Your issue content here.
Your issue content here.
In "What Readers Should Know" section there is no speace between "math and probability" and "needed" words.
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.