Coder Social home page Coder Social logo

dafriedman97 / mlbook Goto Github PK

View Code? Open in Web Editor NEW
1.1K 1.1K 205.0 8.79 MB

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

HTML 39.70% Jupyter Notebook 50.30% TeX 0.06% CSS 0.55% JavaScript 5.49% Python 3.89%

mlbook's People

Contributors

brettkoonce avatar captntardigrade avatar dafriedman97 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mlbook's Issues

Issue on page /content/appendix/math.html

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)

No-constructors classes

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)

Issue on page /content/c2/s2/regularized.html

Correct me if I wrong her,e when i copy paste the whole code it gives me an error of invalid value encountered in matmul eventhough I copied the whole code and pasted on my notebook. Thank you in advance.
image

neural network hidden layers

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

In introduction of the book

In "What Readers Should Know" section there is no speace between "math and probability" and "needed" words.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.