Live data from Hacker News

Show HN: ML From Scratch – free online textbook

dafriedman97.github.io

41–50 of 56 posts

Re: Show HN: ML From Scratch – free online textbook

#42

Excellent! Very kind of you to do this. Are you accepting comments? If not, ignore the following. :) As someone who learned how to program from trial and error via tutorials on the internet (some of the people who are going to read your book are people like me), I just have one comment: Try not leaning on libraries in your tutorials. I know it sounds insane to suggest you not use numpy in any kind of ML tutorial, but…

I agree with you in theory. I really hate that the fast.ai course uses their own fast.ai library.

Numpy is a bit different though as it “fixes” inefficiencies in Python’s typing system. A list of Python integers is actually a list of C structs so none of the values are sequential in memory. A numpy array of integers is sequential in memory and so the performance gains are massive.

It’s not so much a library as it as a way to access efficient data types/structures. I think any mathematical programming in python should start with numpy.

If the author had used Pandas extensively I would agree with you completely.

Re: Show HN: ML From Scratch – free online textbook

#43
post #34

That's a really cool initiative, but I think we disagree on the term "from scratch". Taking a look at the source code, I see you're using sklearn - which is a great tool - but, from scratch, at least for me, implies writing your own code (logistic and linear regression, adaline, perceptron, mlp, knn, kmeans...) I mean, that's how I learned it. But again, congratulations on the initiative.

Perhaps I should have been clearer, but the "code" section within each chapter is not "from scratch". The "construction" section is "from scratch" in that it only uses numpy (not scikit learn). The scikit-learn part is just so new users can see how these could be fit in practice.

I went straight to the "code" section. Didn't know there was stuff in the "construction" section too. I would definitely consider not using sklearn for anything other than data sets. You already defined them, why not use them? Or rename the "code" section. I expected that to be the final code as you build it. Maybe show the usage of both side by side, as a way to ease people into sklearn. But the "code" section should totally be focused on what you made.

Re: Show HN: ML From Scratch – free online textbook

#44

Excellent! Very kind of you to do this. Are you accepting comments? If not, ignore the following. :) As someone who learned how to program from trial and error via tutorials on the internet (some of the people who are going to read your book are people like me), I just have one comment: Try not leaning on libraries in your tutorials. I know it sounds insane to suggest you not use numpy in any kind of ML tutorial, but…

Thanks so much for your feedback. Definitely open to comments! I agree 100% that any use of packages can be intimidating for newbies. I experimented at first with creating the models without using numpy and I thought that it actually made it less clear rather than more clear. It's obviously a tradeoff--you see where everything comes from (rather than np.mysterious_function()) but you take 5 lines of code to do the sa…

I think there is a balance to be struck. You should totally use numpy for the arrays and basic math applications. But say on the first example you use `self.X.T` what does `.T` even do? Not asking you to go into all the details, just more comments saying this transposes the array, see numpy docs . It will ease people into the library if they are unfamiliar with it. You do have some good ones like `column of ones` already, but more of those kinds of things.

I would also avoid using pandas if at all possible. Its just another thing people have to learn if they are unfamiliar.

Re: Show HN: ML From Scratch – free online textbook

#45
post #2

I'm linking to a free online book I just finished called Machine Learning from Scratch. The book aims to cover the complete, technical, "under the hood" details that other ML textbooks don't. To do that, it shows all the mathematical steps to derive common algorithms and demonstrates how to fit each one from scratch in Python (using just numpy). You might like this book if you are interested in ML and like to really…

You said in other comments that you used JupyterBook to make it. Would you consider open sourcing that so that others can contribute?

Re: Show HN: ML From Scratch – free online textbook

#47

Earlier quoted context omitted.

Thanks so much for your feedback. Definitely open to comments! I agree 100% that any use of packages can be intimidating for newbies. I experimented at first with creating the models without using numpy and I thought that it actually made it less clear rather than more clear. It's obviously a tradeoff--you see where everything comes from (rather than np.mysterious_function()) but you take 5 lines of code to do the sa…

I think there is a balance to be struck. You should totally use numpy for the arrays and basic math applications. But say on the first example you use `self.X.T` what does `.T` even do? Not asking you to go into all the details, just more comments saying this transposes the array, see numpy docs . It will ease people into the library if they are unfamiliar with it. You do have some good ones like `column of ones` alr…

I definitely agree. I should add more comments explaining what things like .T does--it's not that it's hard to grasp, but it might turn away newbies. Thanks for the suggestion!

Pandas is only used in the "code" sections, which use packages like scikit-learn anyway

Re: Show HN: ML From Scratch – free online textbook

#48

Earlier quoted context omitted.

Perhaps I should have been clearer, but the "code" section within each chapter is not "from scratch". The "construction" section is "from scratch" in that it only uses numpy (not scikit learn). The scikit-learn part is just so new users can see how these could be fit in practice.

I went straight to the "code" section. Didn't know there was stuff in the "construction" section too. I would definitely consider not using sklearn for anything other than data sets. You already defined them, why not use them? Or rename the "code" section. I expected that to be the final code as you build it. Maybe show the usage of both side by side, as a way to ease people into sklearn. But the "code" section shoul…

That's sensible. Maybe change construction to code and code to application? Or keep construction but rename code? I'll have to brainstorm. I definitely don't want people missing the construction section so this is great feedback. Thanks!

Re: Show HN: ML From Scratch – free online textbook

#49

Earlier quoted context omitted.

I went straight to the "code" section. Didn't know there was stuff in the "construction" section too. I would definitely consider not using sklearn for anything other than data sets. You already defined them, why not use them? Or rename the "code" section. I expected that to be the final code as you build it. Maybe show the usage of both side by side, as a way to ease people into sklearn. But the "code" section shoul…

That's sensible. Maybe change construction to code and code to application? Or keep construction but rename code? I'll have to brainstorm. I definitely don't want people missing the construction section so this is great feedback. Thanks!

I like the sound of Application at least. Or 'In practice'?And Construction does make sense when I think about it more. Not sure I can think of a better name at least.

Re: Show HN: ML From Scratch – free online textbook

#50

Earlier quoted context omitted.

That's sensible. Maybe change construction to code and code to application? Or keep construction but rename code? I'll have to brainstorm. I definitely don't want people missing the construction section so this is great feedback. Thanks!

I like the sound of Application at least. Or 'In practice'?And Construction does make sense when I think about it more. Not sure I can think of a better name at least.

My hesitance with "Application" is that sounds like I'm going to use some interesting dataset or do some cool project (and this is essentially using iris to build basic models). How about "code" becomes "implementation"?
Post reply on HN