Machine Learning Mastery
machinelearningmastery.com · Personal blog · on HN since 2013
Jason Brownlee's site offers tutorials, guides, and books on applied machine learning, with Python code examples for popular models.
What HN saysCommenters point to it for code examples that help them understand models, and one praises its linear algebra book and the responsive author.
99HN people shared it
34linked it in comments
121stories submitted
1.3Kstory points
3 months agolast shared
2013people per year2026
Most-shared posts
- 1Machine Learning Mastery7 people · 1 points · first shared 2016 · discussion on HN
- 2A Tour of Machine Learning Algorithms6 people · 218 points · first shared 2014 · 35 comments on HN
- 3Discover Feature Engineering, How to Engineer Features and How to Get Good at It3 people · 4 points · first shared 2014 · discussion on HN
- 4Text Generation with LSTM NNs in Python with Keras3 people · 4 points · first shared 2017 · discussion on HN
- 5Your First Machine Learning Project in Python Step-By-Step3 people · 1 points · first shared 2019 · discussion on HN
- 6Pretrain a Bert Model from Scratch2 people · 10 points · first shared 2025 · 2 comments on HN
- 7Why Machine Learning Does Not Have to Be So Hard2 people · 6 points · first shared 2018 · discussion on HN
- 8Help Save Missing-kids-in-india with an app, "Helping Faceless"2 people · 5 points · first shared 2014 · discussion on HN
- 9Linear Algebra for Machine Learning2 people · 4 points · first shared 2015 · discussion on HN
- 10The Roadmap to Mastering Tool Calling in AI Agents2 people · 2 points · first shared 2026 · discussion on HN
- 11Deep learning with python2 people · first shared 2016
- 12A Gentle Introduction to Bayes’ Theorem for Machine Learning1 people · 305 points · first shared 2019 · 35 comments on HN
- 13Mistakes Programmers Make when Starting in Machine Learning1 people · 128 points · first shared 2014 · 63 comments on HN
- 14Applied Machine Learning Is a Meritocracy1 people · 127 points · first shared 2019 · 87 comments on HN
- 15Logistic Regression for Image Classification Using OpenCV1 people · 81 points · first shared 2023 · 20 comments on HN
What HN people wrote when they linked it
putnam · 2017-06-14
So, there's a lot of material out there but it's disjointed. If you get annoyed implementing your own neural net with only Python + Numpy, you might try some more complex examples just to immediately point at them and say "I ran this" and "It did that". (The article uses neural networks so I'm addressing that here even though your question and the article title use the much broader 'ML'.)
1) Brandon Rohrer, now Data Scientist at Facebook, has a few great talks, including one on Bayes' Theorem/Bayesian Inference - https://m.youtube.com/playlist?list=PLVZqlMpoM6kbaeySxhdtgQPFEC5nV7Faa
2) When asking future data scientists what tutorials for ML/NNs they like, they have usually found http://machinelearningmastery.com/ through Google and swear by it.
3) Josh Gordon, Developer Advocate at Google, has some simple ML/DL videos up in a 'Recipes' playlist: https://m.youtube.com/playlist?list=PLOU2XLYxmsIIuiBfYad6rFYQU_jL2ryal
If you want to just step through other people's code, you can do that too. Disclaimer: I put the below list together and it's not for ML broadly but for DL. That said if you want to run some examples fast and see the output, a number of folks have made that work for you -
I for one was floored to find great iOS examples (admittedly now deprecated for iOS 11). But If you have an iPhone with Metal (5s and up) Matthijs Hollemans - who wrote the iOS Apprentice at Ray Wenderlich - has Inception, YOLO, and MobileNets pre-trained and ready to go using Xcode, and…
notslow · 2024-11-27
Machine Learning Mastery (https://machinelearningmastery.com) provides code examples for many of the popular models. For me, seeing and writing code has been helpful in understanding how things work and makes it easier to put new developments in context.
rg111 · 2021-11-08
> these work best on predictable things
Umm, not really.
You are talking about single and multi-label classification tasks, maybe?
Bengali poetry is just like poetry in any other rich languages like English, French, etc.
What these models do, from a high level, is that they learn the distribution of the data. In this case, they learn the style of the poets.
Writing poetry in specific styles has been done long before Transformer architectures came.
See-
- https://www.tensorflow.org/text/tutorials/text_generation
- https://machinelearningmastery.com/text-generation-lstm-recurrent-neur…
The goal of poetry generation is to generate something that is unique, is in the poetic style, and is coherrent, grammaticallly correct, ideally indistinguishable in the eyes of a human.
GaltMidas · 2021-07-29
I liked this. It’s a different approach so take a look at the free pages. Not for everyone but worth a look to see if it fits you. Bonus: the author is responsive.
https://machinelearningmastery.com/linear_algebra_for_machine_learning…
aianus · 2019-12-16
> How good will your deep fake have to be in order to fool a deep fake detection AI?
The best generator and the best detector are actually part of the same model! If you create a better detector, you are making the generator better at the same time so you have not accomplished anything.
"GANs are a clever way of training a generative model by framing the problem as a supervised learning problem with two sub-models: the generator model that we train to generate new examples, and the discriminator model that tries to classify examples as either real (from the domain) or fake (generated). The two models are trained together in a zero-sum game, adversarial, until the discriminator model is fooled about half the time, meaning the generator model is generating plausible examples."
https://machinelearningmastery.com/what-are-generative-adversarial-net…
rayalez · 2017-11-08
I'm not an expert, but the best one I could find is this:
https://machinelearningmastery.com/deep-learning-with-python/
Really neat intro, simple examples, using high level libraries (Keras and TF).
gt2 · 2017-01-25
Cool project, nice links, maybe consider adding a "submit link" feature.
Also found a book link that doesn't work:
Your First Machine Learning Project in Python Step-By-Step
http://machinelearningmastery.com/
fauria · 2016-11-25
Machine Learning Mastery has a 40% discount on all their products using the code "blackfriday": http://machinelearningmastery.com/
jasonb05 · 2016-05-12
Author, here. thanks for the interest guys!
If you like my style, I also have material on machine learning (the statistical sort) over at http://machinelearningmastery.com/
PaulHoule · 2023-03-30
Some older books that are good reading:
https://www.amazon.com/Networks-Recognition-Advanced-Econometrics-Pape…
https://machinelearningmastery.com/neural-networks-tricks-of-the-trade…
There is something to say for downloading models from huggingface and just going from there. The fact is you are never going to train a foundation model but you can do useful tasks with one in minutes and if the one you use isn't good for your application try another one. See
https://sbert.net/
particularly the "usage" example that is right there. If you have 1000-10,000 short texts and put them through k-means clustering
https://scikit-learn.org/stable/modules/clustering.html#k-means
your jaw will drop or at least mine did because for years I have done clustering with bag of words, LDA and methods like that and when I applied to my RSS feed all the sports articles ended up in one place, the ukraine articles in another place, deep learning there, and reinforcement learning there... In like 30 minutes worth of work and faster than my LDA clustering engine. With DBSCAN clustering I get all the articles about the same news event clustered... It's just amazing.
soVeryTired · 2021-08-18
I think one of the issues that makes tensors difficult to understand is that different disciplines use the word in different ways. I'm going to generalize here a bit about how each group uses the term, but I suspect not everyone will agree with me. Apologies in advance!
For machine-learning types, a tensor is a multidimensaional array of numbers that admits certain operations (addition, subtraction, hadamard product, etc) [0]
For mathematicians, a tensor is a function F. We pass the function an ordered tuple of N vectors and M covectors (or, to keep things simple, N column vectors and M row vectors), and the function returns a scalar. The function F needs to be linear in each of the N vectors and M covectors. In this view, a matrix is a tensor with N=1, M=1. The operations used by machine learning types arise naturally once you crank the mathematical handle a little bit.
For physicists, a tensor is what mathematicians would refer to as a tensor field. So they take a space X (think R^N), and for each point in the space they associate a mathematician's tensor F as defined above. The properties of the function F are permitted to change from point to point. The Riemannian metric tensor is a classic example of 'tensor' according to this usage.
[0] https://machinelearningmastery.com/introduction-to-tensors-for-machine…
codesushi42 · 2018-12-02
Unlike the other subjects contained in this book, I do not think that any useful understanding of Probability and Statistics could result from only one or two chapters of coverage.
I would recommend a book I found that covers Statistics using Python:
Statistical Methods for Machine Learning
https://machinelearningmastery.com/products/
Personally, I much prefer that book to the free "Think Stats" one available.
You can also find a book there on Linear Algebra and others related to Deep Learning, all containing real implementations with Python.
I have no affiliation with the site; these books have proven so valuable to me that I need to share them.
Anyway, the book mentioned in the OP looks like a great foundation and I picked up a copy as a refresher. I would have also liked to have seen coverage of number theory in this book, with RSA being an application, but that too would have required lengthy explanation for any useful insights to be learned.
dlo · 2016-10-15
Contrary to the other advice around here, I would strongly advise NOT taking a course. I think it is a good idea at some point, but it is not the first thing you should be doing.
The very first thing you should do is play! Identify a dataset you are interested in and get the entire machine learning pipeline up and running for it. Here's how I would go about it.
1) Get Jupyter up and running. You don't really need to do much to set it up. Just grab a Docker image.
2) Choose a dataset.
I wouldn't collect my own data first thing. I would just choose something that's already out there. You don't want to be bogged down by having to wrangle data into the format you need while learning NumPy and Pandas at the same time. You can find some interesting datasets here:
http://scikit-learn.org/stable/datasets/
And don't go with a neural net first thing, even though it is currently in vogue. It requires a lot of tuning before it actually works. Go with a gradient-boosted tree. It works well enough out of the box.
3) Write a classifier for it. Set up the entire supervised machine learning pipeline. Become familiar with feature extraction, feature importance, feature selection, dimensionality reduction, model selection, hyperparameter tuning using grid search, cross-validation, ....
For this step, let scikit-learn be your guide. It has terrific tutorials, and the documentation is a better educational resource than beginning coursework.
http://scikit-learn.org/stable/tutorial/
4)…
smnscu · 2026-05-20
Nice post! You piqued my curiosity, so after a bit of research it turns out that, with techniques like MTP/MLA/CSA, it's quite probable that these models are much more efficient (and maybe bigger? tho 400B sounds about right) than a simple RAM breakdown would suggest.
MTP - https://blog.google/innovation-and-ai/technology/developers-tools/mult…
MLA - https://machinelearningmastery.com/a-gentle-introduction-to-multi-head…
CSA - https://deepseek.ai/blog/deepseek-v4-compressed-attention
b112 · 2024-06-21
Existing "Western" coding languages might have democratic ideas.
(I am wondering if this is the thought process, of the PRC appointed, unskilled person pushing this change.)
https://machinelearningmastery.com/voting-ensembles-with-python/
Oh no! Voting!
AndrewKemendo · 2024-03-06
What? It was written by a human in 2017 and worked then
The code is from: https://machinelearningmastery.com/xgboost-with-python/
Point being, this was firmly "AI" in 2017. It is still widely useful today.
Is it no longer AI? If so why?
Do people believe in the code above less now? If so, why? If not, then the title is wrong if it's AI.
minimaxir · 2023-12-31
The title touts OpenCV, but OpenCV isn't doing much here other than unnecessarily complicating things (which is bad for newbies) and doesn't show off OpenCV's unique capabilities.
In the final code sample, OpenCV is a) loading the image, which could be done with PIL and b) training the model, when the demo imports sklearn which has its own battle-tested logistic regression implementation.
There's a lot of useful things that can be done with machine learning and computer vision, but this article is a bad demo of it that won't work on any other real-world dataset and is out-of-date with more modern CV approaches. Their previous article is a good explanation of the math behind logistic regression, though: https://machinelearningmastery.com/logistic-regression-in-opencv/
peterfirefly · 2023-12-22
Not necessarily. It turns out to really matter how the weights are initialized (randomly, but from which distribution?) for ordinary feed-forward neural nets that only uses standard neurons -- different activation functions have different optimal initialization distributions.
https://machinelearningmastery.com/weight-initialization-for-deep-lear…
A big breakthrough was Kaiming He's work on initialization for ReLU:
https://arxiv.org/abs/1502.01852
(Kaiming is the personal name, He is the family name. He Kaiming is the native Chinese order. Lots of citations use "Kaiming" by mistake.)
adriantam · 2023-04-26
If you want a TensorFlow implementation, here it is: https://machinelearningmastery.com/building-transformer-models-with-at…
sargstuff · 2023-01-16
a few different approaches of many based on search engine topic 'ml with python':
Work though use cases / examples : https://www.databricks.com/resources/ebook/big-book-of-machine-learnin…
On-line class(es) / step by step projects:
* https://bootcamp-sl.discover.online.purdue.edu/ai-machine-learning-cer…
* https://www.w3schools.com/python/python_ml_getting_started.asp
* https://machinelearningmastery.com/machine-learning-in-python-step-by-…
YossarianFrPrez · 2021-11-27
The canonical example of image recognition for AI is recognizing handwritten digits from the NIST dataset; you'll find it in most computer vision tutorials.
If you want to learn about rolling your own:
https://towardsdatascience.com/classifying-mnist-digits-using-pca-deep…
https://machinelearningmastery.com/handwritten-digit-recognition-using…
https://scikit-learn.org/stable/auto_examples/classification/plot_digi…
The only issue is that you'll have to find training data for letters. I'd be surprised if that didn't exist.
Also, Google has an API for recognizing handwriting: https://cloud.google.com/vision/docs/handwriting
I haven't used it, so I can't vouch for it one way or another. But that'd be a pretty easy way to go!
wjnc · 2019-11-10
iocad · 2019-07-04
Frogolocalypse · 2017-08-13
? I've always thought that ML/AI for me was about learning the languages that could express my idea of how it could work. In order to do that myself, I started reading about algorithm types.
http://machinelearningmastery.com/a-tour-of-machine-learning-algorithm…
There was one particular study piece that I remember reading that I believe was written in the late 70's early 80's, but I can't remember its name. It was a HTML unformatted uni course-work document that the guy who wrote it said he'd just keep changing it as required. Really wish I could remember his name.
I have a slightly different bent on what is discussed here, because my particular implementation reflects what I think is important. There are an infinite number of variations. It depends on what you think you think it might be good for.
lemondrops · 2017-08-02
> Even the calmer takes on this are anthromorphizing the machines too much and attributing intelligence to the complete lack thereof.
Exactly. I haven't read the details of the implementation of the system mentioned in the article, but the outputs remind me a lot of
what was returned by a text generating neural network of this tutorial that I did once:
http://machinelearningmastery.com/text-generation-lstm-recurrent-neura…
Especially with fewer epochs (<10) the generated text was part gibberish, part endless repetitions of common phrases or basic words like "the" - simply
because (surprise!) "the" is one of the more frequently used words in speech.
Pulling this out of context, one could also say "This AI is inventing its own language, just by reading Alice in Wonderland!", which is of course utter bullshit.
jacquesm · 2017-07-28
That's called 'data leakage'.
http://machinelearningmastery.com/data-leakage-machine-learning/
myth_drannon · 2017-07-21
http://machinelearningmastery.com/blog/ has some good tutorials on time series and ML in general
crystalPalace · 2016-10-28
I enjoy the way this site is written and its focus on getting developers up and running quickly while still instilling conceptual basics.
http://machinelearningmastery.com/linear-algebra-machine-learning/
http://machinelearningmastery.com/machine-learning-for-programmers/
ioab · 2016-05-19
shankysingh · 2016-04-01
Location:Mumbai, India
Remote: Yes
Willing to relocate: Yes
Technologies: Python, Ruby on Rails, DevOps [Linux/AWS],
Data Analytics [Python], Mysql, Apache Storm
Résumé/CV: https://www.linkedin.com/in/singhshashank
Email:shashank DOT personal AT gmail.com
URL :
* Fighting Child Trafficking with Technology http://www.helpingfaceless.com
* http://machinelearningmastery.com/project-spotlight-face-recognition-w…
* Work Covered by globalpost http://www.globalpost.com/dispatch/news/regions/asia-pacific/india/140…