1 00:00:00,966 --> 00:00:05,800 Welcome to section 34 Principal Component Analysis, or PCA. 2 00:00:06,366 --> 00:00:09,400 Before you get some hands on experience coming up with PCA, 3 00:00:09,800 --> 00:00:14,433 in the practical exercises, we're going to take a look at the intuition behind it. 4 00:00:14,933 --> 00:00:17,466 PCA is considered to be one of the most 5 00:00:17,466 --> 00:00:21,400 used unsupervised algorithms, and can be seen 6 00:00:21,633 --> 00:00:24,833 as the most popular dimensionality reduction algorithm. 7 00:00:26,700 --> 00:00:27,833 PCA is used 8 00:00:27,833 --> 00:00:32,133 for operations such as visualization, feature extraction, 9 00:00:32,133 --> 00:00:36,000 noise filtering, and can be seen in algorithms used for stock market 10 00:00:36,000 --> 00:00:39,833 predictions and gene analysis, just to name a few. 11 00:00:42,900 --> 00:00:44,200 The goal of PCA 12 00:00:44,200 --> 00:00:48,000 is to identify and detect correlation between variables. 13 00:00:48,366 --> 00:00:51,166 If there's a strong correlation and it's found, 14 00:00:51,166 --> 00:00:54,866 then you could reduce the dimensionality, which really what PCA is intended for. 15 00:00:55,200 --> 00:00:57,400 You find the directions 16 00:00:57,400 --> 00:00:59,733 of maximum variance in high dimensional data, 17 00:00:59,733 --> 00:01:03,366 and then you project it into a smaller dimensional subspace while retaining 18 00:01:03,366 --> 00:01:06,600 most of the information, usually again with PCA. 19 00:01:06,600 --> 00:01:11,500 The goal to reduce the dimensions of a deep dimensional data set by projecting it 20 00:01:11,700 --> 00:01:15,866 onto a k dimensional subspace where K is less than D, 21 00:01:16,733 --> 00:01:20,500 and for a overall breakdown and wrap up of the PCA, 22 00:01:20,633 --> 00:01:24,600 we can see here that the mean functions 23 00:01:24,600 --> 00:01:27,833 of the PCA algorithm would be to standardize the data, 24 00:01:29,400 --> 00:01:32,400 obtain the eigenvectors and eigenvalues 25 00:01:32,933 --> 00:01:35,933 to then sort the eigenvalues in descending order. 26 00:01:37,600 --> 00:01:39,800 Construct the projection matrix W 27 00:01:39,800 --> 00:01:42,800 from the selected k eigenvectors 28 00:01:43,633 --> 00:01:46,100 and to transform the original data set, 29 00:01:46,100 --> 00:01:48,733 and you can explore it further if you follow that link. 30 00:01:48,733 --> 00:01:51,400 But one thing I want to examine here 31 00:01:51,400 --> 00:01:54,500 with PCA and I think the visualization is really helpful 32 00:01:55,366 --> 00:01:58,266 if we visit the following link, it's going to take us to this page 33 00:01:58,266 --> 00:02:02,000 where we can actually view it in 2D and 3D examples. 34 00:02:02,033 --> 00:02:05,333 Now with PCA in a 2D, you can start to see the relationship 35 00:02:05,333 --> 00:02:08,333 and how PCA is playing out amongst the variables in the data. 36 00:02:09,033 --> 00:02:11,366 You can also on this site drag them 37 00:02:11,366 --> 00:02:14,366 around, drag the data points around 38 00:02:14,666 --> 00:02:15,766 to see the PCA. 39 00:02:15,766 --> 00:02:18,600 The coordinates, adjust within the system. 40 00:02:18,600 --> 00:02:23,800 But really what I think is helpful is the 3D example with the 3D example, 41 00:02:23,866 --> 00:02:28,200 you can actually see the relationship, the data within this model 42 00:02:28,600 --> 00:02:31,666 and comparing it to the 2D, you know, within the higher dimensional space, 43 00:02:31,700 --> 00:02:35,566 obviously it can be a much easier visualization. 44 00:02:35,800 --> 00:02:39,366 And I think this is helpful really to kind of grasp what PCA is doing. 45 00:02:39,800 --> 00:02:42,800 And if we drag the data points around again, 46 00:02:43,166 --> 00:02:46,733 just for a test, we can click on the show 47 00:02:46,800 --> 00:02:49,966 PCA to reset that and we'll show it. 48 00:02:51,433 --> 00:02:53,400 And we can see the PCA here. 49 00:02:53,400 --> 00:02:55,533 We can actually move the model around. 50 00:02:55,533 --> 00:02:59,033 Since it's not on that 2D plot, we can visualize it within the 3D example. 51 00:02:59,466 --> 00:02:59,733 All right. 52 00:02:59,733 --> 00:03:02,733 So to wrap PCA up short and sweet 53 00:03:02,966 --> 00:03:06,100 PCA is not like linear regression, although it may look like it 54 00:03:06,800 --> 00:03:11,966 because rather than attempting to predict the values, PCA is attempting 55 00:03:11,966 --> 00:03:15,266 to learn about the relationship between the x and y values. 56 00:03:15,633 --> 00:03:18,833 It's quantified by finding a list of principal axes. 57 00:03:19,833 --> 00:03:22,300 And I think one of the best ways is to look at the visualizations. 58 00:03:22,300 --> 00:03:24,800 You don't compare it to 2D and 3D dimension, 59 00:03:24,800 --> 00:03:28,033 the analysis and the visualizations that we looked at before. 60 00:03:28,500 --> 00:03:32,200 In addition, you know, on a side note, PCA does have a weakness. 61 00:03:32,200 --> 00:03:37,833 It is highly affected by outliers in the data, but PCA is considered 62 00:03:37,833 --> 00:03:41,266 to be one of the most used, and it's extremely popular to use. 63 00:03:41,266 --> 00:03:44,266 And I think once you start working through the practical, it will make more sense. 64 00:03:44,700 --> 00:03:47,933 If you have any questions, please let us know and enjoy machine learning.