I've helped hundreds of people start with machine learning.
Everyone asks me the same, fundamental question.
But they all hate my answer. Engineers even more.
Let me try again, but this time I'll show you a few lines of code that will 10x your process:
People always ask: "How do you know what to do now?"
The answer is simple, but nobody likes to hear it: "Well, you don't know."
After a few seconds, I follow up: "You need to experiment to find what works best."
Here is the reality they don't want to hear about:
Machine learning models are hard to optimize for any given problem.
There are just too many variables that we could change!
People aren't used to this. It's hard for them to move from "I know what will happen" to "I need to try and see."
Here is one example:
Let's talk about a concrete idea: "hyperparameters."
Think of these as "configuration settings." Depending on the values you choose, your model will perform differently.
These are the knobs and levers of every machine learning model.
Every model has different hyperparameters.
Here are a few common examples:
• learning rate
• batch size
• epochs
• regularization
The list goes on and on.
In a perfect world, we will find the combination of values for these hyperparameters that's ideal for our problem.
But finding these values is a headache. There are too many possibilities!
We need something better.
I consider myself an organized person.
When I started building models, I kept a spreadsheet with different combinations of values.
Whenever I tried a set of hyperparameters, I carefully took notes of values and results.
There are two problems with this.
First problem:
You don't want to run your experiments manually. There's little chance you'll find an optimal combination by guessing.
Second problem:
Writing down values in a spreadsheet is cumbersome, suboptimal, and prone to errors.
To solve the "finding hyperparameters by hand" part, these are the libraries I use:
1. KerasTuner
2. Optuna
With these, you can automatically find the best hyperparameters for your model.
The first problem was running multiple experiments to find the best set of hyperparameters.
But how do you keep track of all of these experiments?
You can't rely on spreadsheets, at least not if you want to keep your sanity.
A couple of notes:
Notice that my code stayed the same. I just added a couple of lines to connect to @Cometml.
I get all sorts of metrics and charts right from @Cometml's interface. All of them for free!
Over time, you'll have a library of experiments with detailed metrics about everything you did.
You can compare experiments, reproduce them, filter, or go back to any one of them.
You won't ever go back to manual tracking. I promise.
Every week, I post 1 or 2 threads like this, breaking down machine learning concepts and giving you ideas on applying them in real-life situations.
Follow me @svpino and make sure you don't miss my next thread.