Look at all this math and code you need to understand to learn machine learning. It can be very hard. For me at least it was as well.
Until I learned these five secrets. Which honestly aren't even secrets, but no one really teaches you them. Although everyone should know them. I mean, I spent the last three and a half years studying machine learning, and it took me way too long to learn these secrets on my own.
So let me reveal them to you so that you don't have to struggle for that long. You're thinking of math the wrong way around, which already sets you up for failure at the very beginning. But isn't your fault? Back when I started learning machine learning, some of my professors would simply throw a formula on screen and tell us, this is the loss function for a decision tree.
And that was it. I and most other peers were confused and simply stared at the formula and were waiting for a magical aha moment where the formula made sense. I was always asking myself, how those smart scientists could understand math so well they could develop new algorithms and just think in the language of math. Until I realized I was thinking the wrong way around. I was focusing too much on the actual mathematical formulas in the realm of math instead of taking a step back and thinking like a scientist.
I mean I was literally looking at a formula and trying to understand the formula as a whole which for me now after learning the secret Just doesn't make any sense anymore. Don't think of math like something abstract and make it then human interpretable. You need to realize that you need to think the other way around.
Think of the idea a human had, understand it and then think of how to translate it into the language of math. This perhaps sounds very confusing, but math is not a standalone language in which people think. Scientists think just like you and me in natural language. They just know how to translate their ideas into the formalisms of math, which then allows them to be implemented and then further developed using the rules of math.
As mentioned, I was always looking at a formula as a whole, but each component of a formula is just a component of this human idea. For example, a sum or a product are literally just a for loop that can have some conditions that are literally equivalent to an if-else statement in code. Of course, this is easier said than done, and to understand a mathematical concept using human ideas requires someone to actually properly teach you these human ideas, and how to translate them step by step. But in my experience, there are two scenarios. One, the teacher does that already, but you don't understand he does it, because you were never explicitly taught to think that way.
Or two, the teacher does really only look at the formulas and derivations. In that case, you need to try to figure out the original human idea yourself, by for example looking it up online. But the good thing is, you now know it is not your fault, and there is an intuitive understanding to the math that you can find.
Math is just the formalization of a human idea. Very few people actually think in the language of math. It's just a tool.
But when it comes to every intermediate derivation step, Then you often actually think in the language of math, which is very difficult. Unless you know the next secret. This secret literally changed the way I look at scary math derivations like this one. Again, jumping back in time to when I watched a lecture at college, my professor would explain the intuitive idea of an ML algorithm, show the translation into the language of math, and then show us where we want the formula to end up. to make it more efficient or simply actually work as an algorithm that can be implemented.
But at some point he would go off on a derivation spree, writing out one step after the other, and expected us to understand why he did what he did. Everyone was confused and, of course, scared and annoyed. But these derivations are simpler than you might think. Not easy, but much simpler to execute after learning this one secret.
I realized each step was simply applying one specific rule or definition. I realized that, up to a certain degree, these mathematical derivations or transformations just require you to have a list of rules and tricks you need to collect that you can then simply apply. During the lectures, for each step I see, I would explicitly look for the rule and definition they used and write that down on my list. When solving or reading math derivations on my own, for homework assignments or during an exam, in most cases I would literally just do some sort of pattern matching.
I would look at where I currently am Go down my list of rules and definitions and apply what fits the pattern. Of course, some patterns, rules and definitions are harder to spot than others, but after doing this for long enough, you just start to memorize certain patterns. But in general, for most ML math, this secret technique does work wonders. You need to collect your mathematical toolkit and learn to recognize when you can apply which rule.
Which means, practice, practice. practice. But math is of course far from all there is to ML. Coding is also a very challenging skill. Learning the basics of Python and then an ML library like PyTorch is really cool and fun.
You simply follow a tutorial online and have a really steep learning curve. You follow a recipe of steps and implement a lot of code. You really see and feel the progress you are making.
But then when you want to go further and learn to implement actual algorithms or ML pipelines on your own, you hit a wall. All of a sudden, you sit on one annoying problem for several hours, have written perhaps 5 lines of code, and you think you are not making any progress. This is very, very frustrating, and is the point where a lot of people determine coding is really hard and that they will never be able to really learn to code.
Writing 5 lines of code in 3 hours, how pathetic. I mean, I always thought I was so stupid for writing code that never worked until I debugged it for hours. This can get so bad that you don't even want to start coding because you know it will fail. But that is simply the wrong way to think. Actually writing code for one hour will very likely mean, let's say, three hours of debugging.
Once I learned that this is what it really means to be coding, I all of a sudden felt so relieved and just not stupid anymore. Coding ML models didn't feel impossible and hard anymore because I was doing exactly what was normal and expected. And nowadays there are amazing tools that I can't live without like GitHub Copilot that can generate code for you and explain code for you. But there's so much that you simply learn through your own experience or the experience of others.
That's why I have a completely free weekly newsletter where I share my experience as a machine learning researcher including actionable tips, AI news and more. I'll just pin a comment below with the link to sign up. But anyway, you have to realize that writing code is not actually coding.
Debugging is coding. This realization really helps you with implementing things on your own step by step. But when you have to work with an existing code base where you have everything at once, you will probably still be overwhelmed. So let's look at the next secret tip. There are two cases where you will need to understand complex code.
The first one is when building on top of an existing repository. I remember when I started working on my first larger project, where I built on top of an existing code base. It was so much code, I literally had no idea where to start. Just like in the previous secret, I again felt like learning to read code was as impossible as writing code. All those tutorials and smaller personal projects didn't prepare me for this much code.
I tried reading each source file and started to write code as soon as possible into places I thought made sense, but that unsurprisingly led to a lot of headaches and wasting time writing code that was destined to fail. I had to learn the hard way that there is a very simple strategy to understanding large code bases. I wish someone would have simply told me once how to approach a challenge like this. With most large ML repositories, you have a train.py and an evil.py file.
Those should always be the starting point. I find those files at a breakpoint in the beginning and start stepping through the code with the debugger. I cannot emphasize enough how simply yet insanely effective this technique is. It's literally like cheating.
You can step through the data preprocessing, training loop, the actual model, the evaluation metrics and every other detail. Depending on the code base and your experience, this takes just a few hours. and you have an amazing overview of the codebase and will have a much better feeling for where to add the new code for your own idea. That said, you might not always want to build on top of an existing highly optimized codebase, but simply want to understand an algorithm better.
For example, when you want to understand PPO, a famous reinforcement learning algorithm, I would not recommend to look at the optimized implementation. That's way too overkill and complex. Luckily, For many important models, there are minimal educational implementations that just implement the main idea so that people can understand the model. And here, Yet again, the best way is to set a breakpoint in the beginning of the main function and then just start debugging.
Finally, there is one fundamental secret to mastering machine learning that you need to know. This final secret ties everything we just discussed together and is the one reason that will determine your success or failure of mastering ML. 34% of organizations consider poor AI skills Expertise or knowledge as the top reason blocking successful AI adoption, according to an IBM study from 2022. Why do you think people fail learning ML and fall into the category of people with poor AI skills?
Is it because it is hard? Yes, but it was also hard for every person who has now mastered it. People fail to master ML because they stop learning machine learning too early and give up. And why do people give up?
because they have false expectations and don't enjoy the process of learning. They think mastering ML is hard because they didn't learn ML in a few weeks or because they didn't understand a video explaining an ML concept the first time, they will never understand it. I took my first introductory AI college course about three and a half years ago.
After that semester, I took my first real ML course along with working on my first ML projects. After that semester, I continued with my first deep learning courses and continued working on projects and reading a lot of papers. I definitely didn't understand everything the first time, but I knew that was normal. Over time I learned the secrets mentioned before and that somewhat mastering ML takes time. I failed my first ML interviews for internships at Amazon, Neuro and Google DeepMind.
But now I am working with an ex-meta professor and collaborating with a Google DeepMind researcher. It takes time. Period. This is not a skill you learn over a weekend. The 10,000 hour rule applies here as well.
If you spend 10,000 hours on a specific skill, you will master. I'm absolutely not trying to discourage you, rather the opposite. I don't want to be some weird influencer that wants to sell you a dream of mastering ML in a few weeks.
I want to encourage you to really learn machine learning, to really learn the theory, and really gather practical experience. And the Mastery of machine learning comes after learning fundamentals by really working on projects, encountering real-world problems and reading real state-of-the-art papers or respective blog posts. By having this expectation that it will take time, you relax way more and the learning process becomes much easier, enjoyable and successful in the end.
All these secrets are universally true, no matter how you decide to learn machine learning. And I say that because there are mainly three ways to do so. And if you want to find out which one is best for you, you might want to watch this video next. I there talk about data science, but everything applies the same way to machine learning in general.
Bye-bye!