StatQuest: PCA in Python




[ad_1]

You asked for it, you got it! Now I walk you through how to do PCA in Python, step-by-step. It’s not too bad, and I’ll show you how to generate test data, do the analysis, draw fancy graphs and interpret the results. If you want to download the code, here’s the link to the StatQuest GitHub:
https://github.com/StatQuest/pca_demo/blob/master/pca_demo.py

⭐ NOTE: When I code, I use Kite, a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. I love it! https://www.kite.com/get-kite/?utm_medium=referral&utm_source=youtube&utm_campaign=statquest&utm_content=description-only

For a complete index of all the StatQuest videos, check out:
https://statquest.org/video-index/

If you’d like to support StatQuest, please consider…
Patreon: https://www.patreon.com/statquest
…or…
YouTube Membership: https://www.youtube.com/channel/UCtYLUTtgS3k1Fg4y5tAhLbw/join

…a cool StatQuest t-shirt or sweatshirt (USA/Europe): https://teespring.com/stores/statquest
(everywhere):
https://www.redbubble.com/people/starmer/works/40421224-statquest-double-bam?asc=u&p=t-shirt

…buying one or two of my songs (or go large and get a whole album!)
https://joshuastarmer.bandcamp.com/

…or just donating to StatQuest!
https://www.paypal.me/statquest

Lastly, if you want to keep up with me as I research and create new StatQuests, follow me on twitter:
https://twitter.com/joshuastarmer

0:00 Awesome song and introduction
1:06 Load modules and generate data
5:03 Scaling and centering data
7:31 Use scikit for PCA
8:34 Draw a scree plot
9:18 Draw a PCA plot
10:18 Examine the loading scores

#statquest #PCA

Source


[ad_2]

Comment List

  • StatQuest with Josh Starmer
    December 2, 2020

    I like the way you plot the ratio of each PC~~
    It is really easy to read!
    BAM~~~~~~~~~~

  • StatQuest with Josh Starmer
    December 2, 2020

    As always a great presentation and the python code just give the extra bite…

  • StatQuest with Josh Starmer
    December 2, 2020

    dude i'm trying to do isotonic regression with toydataset, but the error show x is not a 1D ARRAY, can i use PCA to turn it into 1D?

  • StatQuest with Josh Starmer
    December 2, 2020

    YOU ARE SAVING MY DEGREE I LOVE YOU SO MUCH I CANT EVEN BELIEVE THIS IS THE SAME MATERIAL IM LEARNING IN MY MACHINE LEARNING CLASS RIGHT NOW.

  • StatQuest with Josh Starmer
    December 2, 2020

    "Note: We use samples as columns in this example because… but there is no requirement to do so."
    "Alternatively, we could have used…"
    "One last note about scaling with sklearn vs scale() in R"

    This is some of the gold that sets StatQuest apart. Thank you! ❤

  • StatQuest with Josh Starmer
    December 2, 2020

    I have listened to the song twice.

  • StatQuest with Josh Starmer
    December 2, 2020

    You've got the right formula for simple explanations. Teach me dawg

  • StatQuest with Josh Starmer
    December 2, 2020

    Hey Josh, how do I find out which feature in the original dataset is to be removed(the one that least affects the variance im assuming)?
    I know we use PCA for the same, but I just can't understand how we select the unimportant feature from the original dataset using PCA.

  • StatQuest with Josh Starmer
    December 2, 2020

    Whenever I search for some machine learning based explanation, I add 'by statquest' in it ^_^. Keep up the great work :')

  • StatQuest with Josh Starmer
    December 2, 2020

    I wondering if you have a video about how to perform RNA-seq, DNA-seq, chip-seq, through python 🙂 what language DO YOU CONSIDER is better python or R?

  • StatQuest with Josh Starmer
    December 2, 2020

    It work! I did it! Finally, however, every dot in my plot doesnt have the label wt or ko. So , I couldn't analyze my data. Any suggestions about how can I fix it?

  • StatQuest with Josh Starmer
    December 2, 2020

    Thank you very much for this tutorial. Please can you explain how to get correlation matrix

  • StatQuest with Josh Starmer
    December 2, 2020

    dear instructor, will you release a python version of your ml course. supper fan here!

  • StatQuest with Josh Starmer
    December 2, 2020

    Hi, by any change, you have video about theory of PLS and how to implement it in Machine Learning?

  • StatQuest with Josh Starmer
    December 2, 2020

    Hi Josh, thanks a lot for this video, it hit the point! I was wondering how to apply PCA in Python and came to this marvelous video.
    I made my own Jupyter Notebook following your instructions and came neatly. One minor problem (I really dunno if it is): my data came all the way around at the last steps. My WildType cluster was at the right, while the KO one was on the left. I tried several times because I thought it was due to randomness, but it always had the same shape. Any ideas on this?
    In other news, I'm from Argentina (I speak Spanish), so I was wondering if my Notebook was of any use to your Spanish-speaking viewers. If so, I would gladly share it!
    Cheers from Argentina, you've got a new Follower 🙂

  • StatQuest with Josh Starmer
    December 2, 2020

    Python ε> now we are talking!

  • StatQuest with Josh Starmer
    December 2, 2020

    Always can find a new and detailed explanation of steps from your videos! Thank you!

  • StatQuest with Josh Starmer
    December 2, 2020

    how do we interpret positive and negative load factors of features in terms of separating the sample?

  • StatQuest with Josh Starmer
    December 2, 2020

    i really like your clear explanation. please do some videos about deep learning and NLP.

  • StatQuest with Josh Starmer
    December 2, 2020

    3:34s, the array only contains 10 elements instead of 12 elements..haha

  • StatQuest with Josh Starmer
    December 2, 2020

    Cool video thanks! How can ı generate numbers basen on poisson dist. that wont change when ı rerun the code for dataframe?

  • StatQuest with Josh Starmer
    December 2, 2020

    Dude you deserve a humanitarian award.

  • StatQuest with Josh Starmer
    December 2, 2020

    Thanks for all the axplanations but I have something in mind. I'm trying to reduce number of variables and I guess I should do that according to loading scores. As the loading scores are super similar how can I do that? Is ıt going to be a meaningfull move?

  • StatQuest with Josh Starmer
    December 2, 2020

    6:31 using scikit PCA
    8:35 plotting scree plot
    10:37 loading scores for each principal component

  • StatQuest with Josh Starmer
    December 2, 2020

    Amazing! this is so important, thanks a lot.

  • StatQuest with Josh Starmer
    December 2, 2020

    Hi Josh Thank you for your efforts,
    really statquest is a magnificent channel ,
    Could you please make video for Singular Value decomposition SVD.
    thanks

  • StatQuest with Josh Starmer
    December 2, 2020

    hello, your lessons are wonderful. can you make computer vision, deep learning, convolutional naural network with python programming language etc.

  • StatQuest with Josh Starmer
    December 2, 2020

    Is loading score eigenvalues? Wish to see a more linear algebra method of explaining pca!

  • StatQuest with Josh Starmer
    December 2, 2020

    Why don't you display the data at least once for god sake??? That would have helped visualize the problem even better.

Write a comment