Dataset bias strikes again! ๐Ÿ˜ฌ

This is a great example of dataset bias! This ML method classifies skin lesions as being malignant or not.

Can you see the problem from the examples? ๐Ÿค”

Let me shortly explain ๐Ÿ‘‡

The dataset used to train the model contains images of both malignant and benign lesions. The problem is that the malignant images often contain rulers printed on the skin. They are used by doctors to assess the lesion over time.

Guess what the model learned... ๐Ÿ‘‡
The ML model learned to detect the rulers... ๐Ÿคทโ€โ™‚๏ธ

"In our dataset, images with rulers were more likely to be malignant; thus the algorithm inadvertently โ€œlearnedโ€ that rulers are malignant."

https://t.co/H00FFokKHr

More from Vladimir Haltakov

Machine Learning in the Real World ๐Ÿง  ๐Ÿค–

ML for real-world applications is much more than designing fancy networks and fine-tuning parameters.

In fact, you will spend most of your time curating a good dataset.

Let's go through the process together ๐Ÿ‘‡

#RepostFriday


Collect Data ๐Ÿ’ฝ

We need to represent the real world as accurately as possible. If some situations are underrepresented we are introducing Sampling Bias.

Sampling Bias is nasty because we'll have high test accuracy, but our model will perform badly when deployed.

๐Ÿ‘‡

Traffic Lights ๐Ÿšฆ

Let's build a model to recognize traffic lights for a self-driving car. We need to collect data for different:

โ–ช๏ธ Lighting conditions
โ–ช๏ธ Weather conditions
โ–ช๏ธ Distances and viewpoints
โ–ช๏ธ Strange variants

And if we sample only ๐Ÿšฆ we won't detect ๐Ÿšฅ ๐Ÿคทโ€โ™‚๏ธ

๐Ÿ‘‡


Data Cleaning ๐Ÿงน

Now we need to clean all corrupted and irrelevant samples. We need to remove:

โ–ช๏ธ Overexposed or underexposed images
โ–ช๏ธ Images in irrelevant situations
โ–ช๏ธ Faulty images

Leaving them in the dataset will hurt our model's performance!

๐Ÿ‘‡


Preprocess Data โš™๏ธ

Most ML models like their data nicely normalized and properly scaled. Bad normalization can also lead to worse performance (I have a nice story for another time...)

โ–ช๏ธ Crop and resize all images
โ–ช๏ธ Normalize all values (usually 0 mean and 1 std. dev.)

๐Ÿ‘‡
Let's talk about a common problem in ML - imbalanced data โš–๏ธ

Imagine we want to detect all pixels belonging to a traffic light from a self-driving car's camera. We train a model with 99.88% performance. Pretty cool, right?

Actually, this model is useless โŒ

Let me explain ๐Ÿ‘‡


The problem is the data is severely imbalanced - the ratio between traffic light pixels and background pixels is 800:1.

If we don't take any measures, our model will learn to classify each pixel as background giving us 99.88% accuracy. But it's useless!

What can we do? ๐Ÿ‘‡

Let me tell you about 3 ways of dealing with imbalanced data:

โ–ช๏ธ Choose the right evaluation metric
โ–ช๏ธ Undersampling your dataset
โ–ช๏ธ Oversampling your dataset
โ–ช๏ธ Adapting the loss

Let's dive in ๐Ÿ‘‡

1๏ธโƒฃ Evaluation metrics

Looking at the overall accuracy is a very bad idea when dealing with imbalanced data. There are other measures that are much better suited:
โ–ช๏ธ Precision
โ–ช๏ธ Recall
โ–ช๏ธ F1 score

I wrote a whole thread on


2๏ธโƒฃ Undersampling

The idea is to throw away samples of the overrepresented classes.

One way to do this is to randomly throw away samples. However, ideally, we want to make sure we are only throwing away samples that look similar.

Here is a strategy to achieve that ๐Ÿ‘‡
Machine Learning Paper Reviews ๐Ÿ”Ž๐Ÿ“œ

Check out this thread for short reviews of some interesting Machine Learning and Computer Vision papers. I explain the basic ideas and main takeaways of each paper in a Twitter thread.

๐Ÿ‘‡ I'm adding new reviews all the time! ๐Ÿ‘‡

AlexNet - the paper that started the deep learning revolution in Computer Vision!


DenseNet - reducing the size and complexity of CNNs by adding dense connections between layers.


Playing for data - generating synthetic GT from a video game (GTA V) and using it to improving semantic segmentation models.


Transformers for image recognition - a new paper with the potential to replace convolutions with a transformer.

More from All

You May Also Like

๐ŸŒฟ๐‘ป๐’‰๐’† ๐’”๐’•๐’๐’“๐’š ๐’๐’‡ ๐’‚ ๐‘บ๐’•๐’‚๐’“ : ๐‘ซ๐’‰๐’“๐’–๐’—๐’‚ & ๐‘ฝ๐’Š๐’”๐’‰๐’๐’–

Once upon a time there was a Raja named Uttฤnapฤda born of Svayambhuva Manu,1st man on earth.He had 2 beautiful wives - Suniti & Suruchi & two sons were born of them Dhruva & Uttama respectively.
#talesofkrishna https://t.co/E85MTPkF9W


Now Suniti was the daughter of a tribal chief while Suruchi was the daughter of a rich king. Hence Suruchi was always favored the most by Raja while Suniti was ignored. But while Suniti was gentle & kind hearted by nature Suruchi was venomous inside.
#KrishnaLeela


The story is of a time when ideally the eldest son of the king becomes the heir to the throne. Hence the sinhasan of the Raja belonged to Dhruva.This is why Suruchi who was the 2nd wife nourished poison in her heart for Dhruva as she knew her son will never get the throne.


One day when Dhruva was just 5 years old he went on to sit on his father's lap. Suruchi, the jealous queen, got enraged and shoved him away from Raja as she never wanted Raja to shower Dhruva with his fatherly affection.


Dhruva protested questioning his step mother "why can't i sit on my own father's lap?" A furious Suruchi berated him saying "only God can allow him that privilege. Go ask him"
One of the most successful stock trader with special focus on cash stocks and who has a very creative mind to look out for opportunities in dark times

Covering one of the most unique set ups: Extended moves & Reversal plays

Time for a ๐Ÿงต to learn the above from @iManasArora

What qualifies for an extended move?

30-40% move in just 5-6 days is one example of extended move

How Manas used this info to book


Post that the plight of the


Example 2: Booking profits when the stock is extended from 10WMA

10WMA =


Another hack to identify extended move in a stock:

Too many green days!

Read