Two of the most significant problems you have to deal with when building machine learning models:

• Overfitting
• Underfitting

Here is a quick mental model to help identify when one of them is happening.

2. Let's start with a quick and simple definition:

Overfitting happens when your model is too complex for your dataset.

For example, a very deep neural network trying to learn a few dozen samples with a couple features.
3. Underfitting happens when your model is too simple for your dataset.

For example, a linear regression model trying to learn a large dataset with hundreds of features.
4. How can you identify whether your model is overfitting or underfitting?

You can look at the loss on both your train and test data.

Let's look at a few different patterns:
5. First, let's focus on the train set:

• If the loss is low, your model is either overfitting or is working well (you can't say.)

• But if the loss is high, your model is underfitting!

If the train loss is low, you can then look at the test loss.
6. Let's now look at the loss on the test set:

• If the loss is low, your model is working well.

• If the loss is high, your model is either overfitting or underfitting (you can't say.)

You now have everything you need to make a decision:
7. Let's summarize by looking at the train and test losses:

• Are both high? You are underfitting.

• Are both low? Your model is working well.

• Is train loss low, and test loss high? You are overfitting.
8. A quick suggestion:

Always start by overfitting your data. Make sure everything works, and only then, start simplifying and regularizing until you get a good model.

Looking for more practical machine learning content? Follow me @svpino for weekly tips and stories.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with svpino.eth

svpino.eth Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @svpino

22 Dec
Two helpful metrics to evaluate a machine learning model: Sensitivity and Specificity.

Here is how they work: ↓
2. I'm mainly used to thinking about Precision and Recall, but these new metrics come in handy when working with a ROC curve.

They are less popular in the machine learning community but widely used in other fields.
3. Let's start with Sensitivity.

Sensitivity → True Positive Rate. The capacity of a model to identify positive samples.

Sensitivity = (TP) / TP + FN

This should look very familiar: Sensitivity and Recall are the same things!
Read 8 tweets
9 Dec
One of the most useful Python libraries that you can learn is Pandas.

Especially if you want to build some skills in the data engineering or machine learning space, Pandas is crucial.

Here is what you need to know to get started right away. ↓
2. Pandas is an open-source library to analyze and manipulate data.

Some people even consider it the most powerful library to deal with data in any language!
3. A common way to use Pandas:

First, load a CSV file or a database table as a Python object.

Then, filter the data, aggregate it in any way you'd like, and do pretty much whatever you can imagine.

It's really powerful.
Read 7 tweets
7 Dec
Interviewing for technical positions is a broken process.

I believe this is going to change soon.

Getting a job in the software industry we’ll look very different within the next 10 years.

Some thoughts: ↓
2. This is the game we are playing today:

Write down in a piece of paper as much stuff as you possibly can. Make sure you embellish the story. Make yourself look like a hero.

Call this a "resume" and email it to as many companies as you can.
3. Companies collect a list of those resumes.

They sort them by the biggest liars: whoever sells themselves the best, goes right to the top.

They choose the top 10 and start making calls.
Read 18 tweets
3 Dec
When I was at school, I designed a banking application that didn't need authentication (for a class project.)

Yeah, I know it sounds crazy, but I've always been obsessed with "invisible" security.

I see one solution that may get us there for the first time. ↓
The thing that has impressed me the most during my experiments with web3:

You open a website, connect your wallet, and you are in.

That's it.

No "sign up," no "username and password," no "check your email for verification."
I use Dashlane (a password manager.) I have 520 passwords, and I'm reusing 149 of them.

Even better: I have 33 "compromised" passwords.

This is ridiculous.
Read 6 tweets
1 Dec
What is machine learning and why you should care about it?

Let me try to convince you: ↓
2. Let's start with a simple programming exercise:

"Write a function that returns 0 if a supplied number is even or 1 if the number is odd."

If you are a developer, I'm sure you know how to write this function.
3. To simplify things, let's represent this function as follows:

y = f(X)

Where:
• X → The input number
• y → The result (0 if even, 1 if odd)
• f → The function that does the work

We can now get to the interesting part.
Read 16 tweets
29 Nov
One of the things I love about Python: Duck Typing + EAFP.

A short thread that will change the way you write code.

2. The idea behind Duck Typing:

If it looks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck.

In other words: the functionality of an object is more important than its type. If the object quacks, then it's a duck.
3. Duck Typing is possible in dynamic languages.

Look at the attached example.

Notice how "Playground" doesn't care about the specific type of the supplied item. Instead, it assumes that it supports the bounce() function.
Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(