{"id":168210,"date":"2026-02-18T06:38:06","date_gmt":"2026-02-18T05:38:06","guid":{"rendered":"https:\/\/liora.io\/en\/?p=168210"},"modified":"2026-08-08T12:29:19","modified_gmt":"2026-08-08T11:29:19","slug":"pca-principal-component-analysis-what-is-it","status":"publish","type":"post","link":"https:\/\/liora.io\/en\/pca-principal-component-analysis-what-is-it","title":{"rendered":"PCA (Principal Component Analysis): What is it?"},"content":{"rendered":"\n<p><strong>Do you know the PCA? A very useful method used in dimension reduction, discover how it works in this article.<\/strong><\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-the-principal-component-analysis\">What is the Principal Component Analysis?<\/h2>\n\n\n<p>Who has never had in his hands a dataset containing a very large number of variables without knowing which are the most important?\u00a0 How to reduce this dataset to represent it simply on 2 or 3 axes? Here is the PCA!<\/p>\n\n\n<p>Principal Component Analysis answers these questions. PCA is a well-known <strong>method of dimension reduction<\/strong> that will allow the transformation of <strong>highly correlated variables<\/strong> into new variables that are decorrelated from each other.<\/p>\n\n\n<p>The principle is simple: It is a matter of <strong>summarizing the information <\/strong>contained in a large <a href=\"https:\/\/liora.io\/en\/database-what-is-it\">database<\/a> into a certain number of synthetic variables called: Principal Components.<\/p>\n\n\n<p>The idea is then to be able to project these data on the <strong>nearest hyperplane<\/strong> to have a simple representation of our data.<\/p>\n\n\n<p>Of course, <strong>dimension reduction means a loss of information<\/strong>. This is the challenge of a Principal Component Analysis. We must be able to reduce the dimension of our data while keeping a maximum of information.<\/p>\n\n\n<h3 class=\"wp-block-heading\" id=\"how-does-a-principal-component-analysis-work\">How does a Principal Component Analysis work?<\/h3>\n\n\n<p>To illustrate the principle of PCA, we will<strong> take for example a dataset <\/strong><\/p>\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\" style=\"width:680px;max-width:100%;margin-top:32px;margin-right:auto;margin-bottom:32px;margin-left:auto\"><img alt=\"ACP_1\" decoding=\"async\" height=\"246\" loading=\"lazy\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/05\/ACP_1.webp\" style=\"width:680px;max-width:100%;height:auto\" width=\"800\"\/><\/figure>\n\n\n<p>Thereafter it is important to <strong>center and reduce our variables<\/strong> to mitigate the scale effect because they are not calculated on the same basis.<\/p>\n\n\n<p>Once this step has been completed, we must see our data as a <strong>matrix<\/strong> from which we will calculate from which we will <strong>calculate eigenvalues<\/strong> and <strong>eigenvectors<\/strong>.<\/p>\n\n\n<p>In linear algebra, the notion of eigenvector corresponds to the <strong>study of privileged axes<\/strong>, according to which an application of a space in itself behaves like a dilation, multiplying the vectors by a constant called an eigenvalue. The vectors to which it applies are called eigenvectors,<strong> combined in an eigenspace.<\/strong><\/p>\n\n\n<p>After importing the PCA module from sklearn.decomposition, the eigenvalues returned are<\/p>\n\n\n<p>The eigenvalues are: [3.48753851 1.47902877 1.15061758 0.93557048 0.65529084 0.15140052]<\/p>\n\n\n<p>These eigenvalues will allow us to <strong>determine the optimal number of factors\/principal components<\/strong> for our PCA. For example, if the optimal number of components is 2, then our data will be represented on<strong> two axes<\/strong>, and so on.<\/p>\n\n\n<figure class=\"wp-block-image size-full\" style=\"margin-top:32px;margin-bottom:32px\"><img alt=\"Illustration for How does a Principal Component Analysis work?\" decoding=\"async\" height=\"572\" loading=\"lazy\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/05\/ACP_3-3-1024x732.jpg\" style=\"width:100%;height:auto\" width=\"800\"\/><\/figure>\n\n\n<p>On this graph which represents the number of factors to choose from according to the eigenvalues, we indicate that the <strong>optimal choice of factor <\/strong>is 2 (thanks to the elbow method). Thus, we will go from dimension 9 to dimension 2 which considerably<strong> reduces the basic dimension<\/strong>. As said before, there will necessarily be a<strong> loss of information<\/strong> following this reduction. However, we still keep a rate of information of almost 70% which will allow us to have a representation close to my representation in 9 dimensions.<\/p>\n\n\n<p>Once the PCA module has <strong>calculated the coordinates of our data<\/strong>, all that remains to be done is to represent them, but before doing so, we are going to<strong> take an interest in a tool<\/strong> that is very often used when performing a Principal Component Analysis, namely the <strong>correlation circle<\/strong>.<\/p>\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\" style=\"width:512px;max-width:100%;margin-top:32px;margin-right:auto;margin-bottom:32px;margin-left:auto\"><img alt=\"ACP_4\" decoding=\"async\" height=\"474\" loading=\"lazy\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/05\/ACP_4.jpg\" style=\"width:512px;max-width:100%;height:auto\" width=\"512\"\/><\/figure>\n\n\n<p>As our representation is done on 2 axes, the correlation circle is a<strong> practical tool <\/strong>that allows us to<strong> visualize the importance of each explanatory<\/strong> variable for each representation axis. The direction of each arrow indicates the axis explained by the variable and the direction indicates whether the correlation is positive or negative.<\/p>\n\n\n<p>We notice that <strong>variables<\/strong> such as &#8216;income&#8217;, &#8216;gdpp&#8217;, and &#8216;health&#8217; are positively correlated to the first axis, while &#8216;child_mort&#8217; or &#8216;total_fer&#8217; are also <strong>positively correlated<\/strong> but negatively. We can then look at the representation of countries in the two axes chosen by the PCA and see the influence of the variable &#8216;life_expec&#8217; on their representations.<\/p>\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\" style=\"width:512px;max-width:100%;margin-top:32px;margin-right:auto;margin-bottom:32px;margin-left:auto\"><img alt=\"ACP_5\" decoding=\"async\" height=\"493\" loading=\"lazy\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/05\/ACP_5.jpg\" style=\"width:512px;max-width:100%;height:auto\" width=\"512\"\/><\/figure>\n\n\n<p>Here is a <strong>representation of each country<\/strong> (167) on 2 axes. To judge the quality of our representation, we decided to color each country according to the life expectancy of each one in 3 groups, we can observe a certain trend. We can then notice that the countries with a high life expectancy are concentrated in the <strong>lower right part<\/strong> of the graph. According to the <strong>correlation circle<\/strong>, the individuals in this part are partly explained by the variables &#8216;health&#8217;, &#8216;income&#8217;, or &#8216;gdb&#8217;. It can be concluded that <strong>countries spending more on health have a higher life expectancy<\/strong>. The same is true for the countries in the upper left part of the graph. According to the correlation circle, this part is mostly explained by the variables &#8216;child_death&#8217; or &#8216;total_iron&#8217;.<\/p>\n\n\n<p>If you want to learn more about <strong>Principal Component Analysis<\/strong> or other <strong>dimension reduction methods<\/strong>, there are several modules dedicated to it in <a href=\"\/en\/courses\/data-ai\/data-analyst\">our Data Analyst training<\/a>.<\/p>\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center wp-container-core-buttons-is-layout-5ee10de4\" style=\"margin-top:32px;margin-bottom:32px\"><div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/liora.io\/en\/courses\/data-ai\/data-scientist\">Discover our Data Science courses<\/a><\/div><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>Do you know the PCA? A very useful method used in dimension reduction, discover how it works in this article. What is the Principal Component Analysis? Who has never had in his hands a dataset containing a very large number of variables without knowing which are the most important?\u00a0 How to reduce this dataset to [&hellip;]<\/p>\n","protected":false},"author":74,"featured_media":207098,"comment_status":"open","ping_status":"open","sticky":false,"template":"elementor_theme","format":"standard","meta":{"_acf_changed":false,"editor_notices":[],"footnotes":""},"categories":[2433],"class_list":["post-168210","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-ai"],"acf":[],"_links":{"self":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/168210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/users\/74"}],"replies":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/comments?post=168210"}],"version-history":[{"count":4,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/168210\/revisions"}],"predecessor-version":[{"id":209832,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/168210\/revisions\/209832"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media\/207098"}],"wp:attachment":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media?parent=168210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/categories?post=168210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}