PCA is one of the most famous algorithms for dimensionality reduction and you are very likely to have heard about it in Machine Learning.

But have you ever seen it in action on a dataset?

If not, check this thread 🧵↓ for a quick depiction:
If you are not sure how PCA works, check this wonderful thread by @TivadarDanka

Let us consider a very simple Image Dataset, the Fashion MNIST dataset, which has thousands of images of fashion apparel.

Using PCA we can reduce the amount of information that we want, we can choose up to a certain amount that seems necessary for our particular task.
It still would have a lot of the information of the entire dataset.

We fit the PCA, and it breaks down the image information in terms of several components. We can try with 4 components here.

We can try different numbers of components and see how many are enough for our case.
Here we can think of the variance explained by each component in the images as the measure of information.

We can see for each component how much information it is capturing in multiple ways.

Here's a bar chart with the y-axis showing the variance for each component.
In above bar chart the components show around 29, 18, 6, and 5 explained variance

Cumulative Sum can be used to show that if we combine them then how much of the variance in total we would be able to explain.

Here's a line plot with individual and cumsum variance explained.
Now we can see in total we are able to explain about 58% of the variance by just 4 components

We can visualize each of them in terms of the images as well.

This would give us a better idea of the features from the images that are being captured by those components.
In the first component, we can see the shirt-like feature captured which is so common in the data.
And a very transparent shape for the shoe, hinting at some of the footwear variances captured.

Here's the entire code snippet for PCA and the plots.

Hope this helps!👍

• • •

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

Keep Current with Prashant

Prashant 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 @capeandcode

30 Apr
Since 2000 of you have connected with me.
Here are some of the most informative threads that I posted this month ↓

You can find all the good threads on my twitter github repository as well

github.com/hashbanger/Twi…

Thanks ! Gracias ! धन्यवाद ! ✨
Read 8 tweets
20 Apr
If you don't understand the principle of Backpropagation or the notion of the maths behind it.

Then this 🧵 could be helpful for you.

We are going to use a simple analogy to understand better

(Check final tweets for notes)

↓ 1/11
Consider you (Harry) are trying to solve a puzzle along with two of your friends, Tom and Dick
And sadly none of you guys are among the brightest.

But you start trying to put the puzzle together.

2/11
Tom has put the first 6 pieces out of 20, 2 of them are wrong, then passes the puzzle to Dick.
Dick puts the next 8 pieces, 6 of them wrong, then passes the puzzle to you.
And now, you put the final 6 pieces, 4 of them wrong.

The picture is complete.

3/11
Read 12 tweets
17 Apr
Calculating Convolution sizes is something that I found particularly hard after understanding convolutions for the first time.

I couldn't remember the formula because I didn't understand its working exactly.

So here's my attempt to get some intuition behind the calculation.🔣👇 Image
BTW if you haven't read the thread 🧵 on 1D, 2D, 3D CNN, you may want to check it out once.

First, observe the picture below🖼 Image
Read 14 tweets
14 Apr
Convolutions! 1D! 2D! 3D!🔲

I've had a lot of trouble understanding different convolutions
What do different convolutions do anyway❓

Without the correct intuition, I found defining any CNN architecture very unenjoyable.

So, here's my little understanding (with pictures)🖼👇
The Number associated with the Convolution signifies two things:
🔸The number of directions the filter moves in and,
🔸The dimensions of the output

Each convolution expects different shapes of inputs and results in output equal to the dimensions it allows the filter to move in.
In 1⃣D-Conv, the kernel moves along a single axis.
It is generally applied over the inputs that also vary along a single dimension, ex: electric signal.

The input could be a 1D array and a small 1D kernel can be applied over it to get another 1D array as output.
Read 9 tweets
12 Apr
Types of Models

In Time-Series Data, we have to observe which model fits the nature of the current data.

Two types of Models are:

🔸Additive Models
🔸Multiplicative Models

Let's discuss in brief 👇 Image
ADDITIVE MODELS

🔹Synthetically it is a model of data in which the effects of the individual factors are differentiated and added to model the data.

It can be represented by:

𝘆(𝘁) = 𝗟𝗲𝘃𝗲𝗹 + 𝗧𝗿𝗲𝗻𝗱 + 𝗦𝗲𝗮𝘀𝗼𝗻𝗮𝗹𝗶𝘁𝘆 + 𝗡𝗼𝗶𝘀𝗲
🔹An additive model is optional for Decomposition procedures and for the Winters' method.

🔹An additive model is optional for two-way ANOVA procedures. Choose this option to omit the interaction term from the model.
Read 8 tweets
31 Mar
How would you interpret the situation if you train a model and see your graphs like these? 📈📉

#machinelearning
If you just focus on the left side, it seems to make sense.
The training loss going down, the validation loss going up.
Clearly, seems to be an overfitting problem? Right?
But the graphs on the right don't seem to make sense in terms of overfitting.

The training accuracy is high, which is fine, but why is that validation accuracy is going up if the validation loss is getting worse, shouldn't it go down too?

Is it still overfitting?

YES!
Read 9 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 Become our Patreon

Thank you for your support!

Follow Us on Twitter!