{"id":1184,"date":"2024-07-14T10:13:47","date_gmt":"2024-07-14T10:13:47","guid":{"rendered":"http:\/\/www.ohsumin.com\/?p=1184"},"modified":"2025-06-11T01:23:00","modified_gmt":"2025-06-11T01:23:00","slug":"%ec%a3%bc%ec%84%b1%eb%b6%84%eb%b6%84%ec%84%9dpca-principal-component-analysis","status":"publish","type":"post","link":"http:\/\/www.inmining.co.kr\/?p=1184","title":{"rendered":"\uc8fc\uc131\ubd84\ubd84\uc11d(PCA: Principal Component Analysis)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\uc8fc\uc131\ubd84 \ubd84\uc11d(PCA, Principal Component Analysis)\uc740 \uace0\ucc28\uc6d0 \ub370\uc774\ud130\ub97c \uc800\ucc28\uc6d0\uc73c\ub85c \ucd95\uc18c\ud558\ub294 \ub370 \uc0ac\uc6a9\ub418\ub294 \uae30\ubc95\uc785\ub2c8\ub2e4. \uc774 \ubc29\ubc95\uc740 \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud654\ud558\ub294 \uc0c8\ub85c\uc6b4 \ucd95(\uc8fc\uc131\ubd84)\uc744 \ucc3e\uc544 \ub370\uc774\ud130\ub97c \uc7ac\uad6c\uc131\ud569\ub2c8\ub2e4. PCA\ub294 \ub370\uc774\ud130\uc758 \uc8fc\uc694 \ud2b9\uc131\uc744 \uc720\uc9c0\ud558\uba74\uc11c \ucc28\uc6d0\uc744 \uc904\uc5ec, \uc2dc\uac01\ud654, \ub178\uc774\uc988 \uac10\uc18c, \ub370\uc774\ud130 \uc555\ucd95 \ub4f1\uc758 \ubaa9\uc801\uc73c\ub85c \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\\(\\)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%EC%A3%BC%EC%84%B1%EB%B6%84_%EB%B6%84%EC%84%9D%EC%9D%98_%EC%A3%BC%EC%9A%94_%EA%B0%9C%EB%85%90\"><\/span>\uc8fc\uc131\ubd84 \ubd84\uc11d\uc758 \uc8fc\uc694 \uac1c\ub150<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\ubd84\uc0b0 (Variance)<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc740 \ub370\uc774\ud130 \uac12\uc774 \ud3c9\uade0\uac12\uc73c\ub85c\ubd80\ud130 \uc5bc\ub9c8\ub098 \ud37c\uc838 \uc788\ub294\uc9c0\ub97c \ub098\ud0c0\ub0c5\ub2c8\ub2e4. PCA\ub294 \ubd84\uc0b0\uc774 \ucd5c\ub300\uc778 \ubc29\ud5a5\uc73c\ub85c \uc8fc\uc131\ubd84\uc744 \ucc3e\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\uc8fc\uc131\ubd84 (Principal Components)<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc8fc\uc131\ubd84\uc740 \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud654\ud558\ub294 \uc0c8\ub85c\uc6b4 \ucd95\uc785\ub2c8\ub2e4. \uccab \ubc88\uc9f8 \uc8fc\uc131\ubd84\uc740 \uac00\uc7a5 \ud070 \ubd84\uc0b0\uc744 \uc124\uba85\ud558\uace0, \ub450 \ubc88\uc9f8 \uc8fc\uc131\ubd84\uc740 \uccab \ubc88\uc9f8 \uc8fc\uc131\ubd84\uacfc \uc9c1\uad50(orthogonal)\ud558\uba74\uc11c \uadf8 \ub2e4\uc74c\uc73c\ub85c \ud070 \ubd84\uc0b0\uc744 \uc124\uba85\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\uace0\uc720\uac12 (Eigenvalues)\uc640 \uace0\uc720\ubca1\ud130 (Eigenvectors)<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uacf5\ubd84\uc0b0 \ud589\ub82c\uc758 \uace0\uc720\uac12\uacfc \uace0\uc720\ubca1\ud130\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc8fc\uc131\ubd84\uc744 \ucc3e\uc2b5\ub2c8\ub2e4. \uace0\uc720\uac12\uc740 \uc8fc\uc131\ubd84\uc758 \uc911\uc694\ub3c4\ub97c \ub098\ud0c0\ub0b4\uace0, \uace0\uc720\ubca1\ud130\ub294 \uc8fc\uc131\ubd84\uc758 \ubc29\ud5a5\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"PCA%EC%9D%98_%EC%A0%88%EC%B0%A8\"><\/span>PCA\uc758 \uc808\ucc28<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\ub370\uc774\ud130 \ud45c\uc900\ud654<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ub370\uc774\ud130\uc758 \uac01 \ubcc0\uc218(\ud2b9\uc131)\uac00 \ub2e4\ub978 \ub2e8\uc704\ub97c \uac00\uc9c0\uace0 \uc788\uac70\ub098 \ud06c\uae30\uac00 \ub2e4\ub97c \uc218 \uc788\uc73c\ubbc0\ub85c, \ud45c\uc900\ud654\ub97c \ud1b5\ud574 \ud3c9\uade0\uc774 0\uc774\uace0 \ubd84\uc0b0\uc774 1\uc774 \ub418\ub3c4\ub85d \ubcc0\ud658\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\uacf5\ubd84\uc0b0 \ud589\ub82c \uacc4\uc0b0<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ud45c\uc900\ud654\ub41c \ub370\uc774\ud130\uc758 \uacf5\ubd84\uc0b0 \ud589\ub82c\uc744 \uacc4\uc0b0\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\uace0\uc720\uac12\uacfc \uace0\uc720\ubca1\ud130 \uacc4\uc0b0<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uacf5\ubd84\uc0b0 \ud589\ub82c\uc758 \uace0\uc720\uac12\uacfc \uace0\uc720\ubca1\ud130\ub97c \uacc4\uc0b0\ud558\uc5ec \uc8fc\uc131\ubd84\uc744 \ucc3e\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\uc8fc\uc131\ubd84 \uc120\ud0dd<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uace0\uc720\uac12\uc758 \ud06c\uae30\uc5d0 \ub530\ub77c \uc911\uc694\ud55c \uc8fc\uc131\ubd84\uc744 \uc120\ud0dd\ud569\ub2c8\ub2e4. \uc77c\ubc18\uc801\uc73c\ub85c \ub204\uc801 \uc124\uba85 \ubd84\uc0b0\uc774 70-90% \uc774\uc0c1\uc778 \uc8fc\uc131\ubd84\uc744 \uc120\ud0dd\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\ub370\uc774\ud130 \ubcc0\ud658<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc6d0 \ub370\uc774\ud130\ub97c \uc120\ud0dd\ud55c \uc8fc\uc131\ubd84\uc73c\ub85c \ubcc0\ud658\ud558\uc5ec \uc800\ucc28\uc6d0 \ub370\uc774\ud130\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"PCA%EC%9D%98_%EC%98%88%EC%8B%9C_Python_%EC%BD%94%EB%93%9C\"><\/span>PCA\uc758 \uc608\uc2dc (Python \ucf54\ub4dc)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\ub2e4\uc74c\uc740 Python\uc744 \uc0ac\uc6a9\ud558\uc5ec PCA\ub97c \uc218\ud589\ud558\ub294 \uac04\ub2e8\ud55c \uc608\uc2dc\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport pandas as pd\nfrom sklearn.decomposition import PCA\nimport matplotlib.pyplot as plt\n\n# \uc608\uc2dc \ub370\uc774\ud130 \uc0dd\uc131\nnp.random.seed(0)\ndata = np.random.randn(100, 5)  # 100\uac1c\uc758 \uc0d8\ud50c\uacfc 5\uac1c\uc758 \ud2b9\uc131\n\n# \ub370\uc774\ud130\ud504\ub808\uc784\uc73c\ub85c \ubcc0\ud658\ndf = pd.DataFrame(data, columns=&#091;'Feature1', 'Feature2', 'Feature3', 'Feature4', 'Feature5'])\n\n# \ub370\uc774\ud130 \ud45c\uc900\ud654\ndf_standardized = (df - df.mean()) \/ df.std()\n\n# PCA \ubaa8\ub378 \uc0dd\uc131 \ubc0f \ud559\uc2b5\npca = PCA(n_components=2)\nprincipal_components = pca.fit_transform(df_standardized)\n\n# \uc8fc\uc131\ubd84 \ub370\uc774\ud130\ud504\ub808\uc784 \uc0dd\uc131\ndf_pca = pd.DataFrame(data=principal_components, columns=&#091;'Principal Component 1', 'Principal Component 2'])\n\n# \uc8fc\uc131\ubd84 \ubd84\uc11d \uacb0\uacfc \uc2dc\uac01\ud654\nplt.figure(figsize=(10, 6))\nplt.scatter(df_pca&#091;'Principal Component 1'], df_pca&#091;'Principal Component 2'])\nplt.xlabel('Principal Component 1')\nplt.ylabel('Principal Component 2')\nplt.title('PCA Result')\nplt.grid(True)\nplt.show()\n\n# \uc124\uba85\ub41c \ubd84\uc0b0 \ube44\uc728 \ucd9c\ub825\nprint('Explained Variance Ratio:', pca.explained_variance_ratio_)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%EA%B2%B0%EA%B3%BC_%ED%95%B4%EC%84%9D\"><\/span>\uacb0\uacfc \ud574\uc11d<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\ubd84\uc0b0 \uc124\uba85 \ube44\uc728 (Explained Variance Ratio)<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>pca.explained_variance_ratio_<\/code>\ub294 \uac01 \uc8fc\uc131\ubd84\uc774 \uc804\uccb4 \ubd84\uc0b0\uc5d0\uc11c \ucc28\uc9c0\ud558\ub294 \ube44\uc728\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4.<\/li>\n\n\n\n<li>\uc608\ub97c \ub4e4\uc5b4, \uccab \ubc88\uc9f8 \uc8fc\uc131\ubd84\uc774 70%\uc758 \ubd84\uc0b0\uc744 \uc124\uba85\ud558\uace0, \ub450 \ubc88\uc9f8 \uc8fc\uc131\ubd84\uc774 20%\uc758 \ubd84\uc0b0\uc744 \uc124\uba85\ud558\uba74, \uc774 \ub450 \uc8fc\uc131\ubd84\uc774 \uc804\uccb4 \ubd84\uc0b0\uc758 90%\ub97c \uc124\uba85\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\uc2dc\uac01\ud654<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc8fc\uc131\ubd84 \ubd84\uc11d \uacb0\uacfc\ub97c 2D \ud3c9\uba74\uc5d0 \uc2dc\uac01\ud654\ud558\uc5ec, \ub370\uc774\ud130\uc758 \uc8fc\uc694 \uad6c\uc870\uc640 \ud328\ud134\uc744 \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n\n\n\n<li>\uac01 \uc810\uc740 \ubcc0\ud658\ub41c \ub370\uc774\ud130 \ud3ec\uc778\ud2b8\ub97c \ub098\ud0c0\ub0b4\uba70, \uc8fc\uc131\ubd84 \uacf5\uac04\uc5d0\uc11c\uc758 \uc704\uce58\ub97c \ubcf4\uc5ec\uc90d\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"PCA%EC%9D%98_%EC%9E%A5%EC%A0%90\"><\/span>PCA\uc758 \uc7a5\uc810<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\ucc28\uc6d0 \ucd95\uc18c<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ub370\uc774\ud130\uc758 \ucc28\uc6d0\uc744 \uc904\uc5ec, \uc2dc\uac01\ud654 \ubc0f \uacc4\uc0b0 \ud6a8\uc728\uc131\uc744 \ub192\uc77c \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\ub178\uc774\uc988 \uac10\uc18c<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc8fc\uc694 \uc131\ubd84\ub9cc \ub0a8\uae30\uace0 \ub178\uc774\uc988 \uc131\ubd84\uc744 \uc81c\uac70\ud558\uc5ec \ub370\uc774\ud130\uc758 \ud488\uc9c8\uc744 \ud5a5\uc0c1\uc2dc\ud0ac \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\ub370\uc774\ud130 \uc555\ucd95<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ub370\uc774\ud130\uc758 \uc911\uc694\ud55c \uc815\ubcf4\ub97c \uc720\uc9c0\ud558\uba74\uc11c \ub370\uc774\ud130 \ud06c\uae30\ub97c \uc904\uc77c \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\ubcc0\uc218 \uac04\uc758 \uc0c1\uad00 \uad00\uacc4 \uc81c\uac70<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc8fc\uc131\ubd84\uc740 \uc11c\ub85c \uc9c1\uad50\ud558\ubbc0\ub85c, \uc0c1\uad00 \uad00\uacc4\uac00 \uc788\ub294 \ubcc0\uc218\ub4e4\uc744 \ub3c5\ub9bd\uc801\uc778 \ubcc0\uc218\ub4e4\ub85c \ubcc0\ud658\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"PCA%EC%9D%98_%ED%95%9C%EA%B3%84\"><\/span>PCA\uc758 \ud55c\uacc4<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\ud574\uc11d\uc758 \uc5b4\ub824\uc6c0<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc8fc\uc131\ubd84\uc774 \uc6d0\ub798 \ubcc0\uc218\uc758 \uc120\ud615 \uacb0\ud569\uc73c\ub85c \uc774\ub8e8\uc5b4\uc9c0\ubbc0\ub85c, \ud574\uc11d\uc774 \uc5b4\ub824\uc6b8 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\uc120\ud615\uc131 \uac00\uc815<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PCA\ub294 \uc120\ud615 \ubcc0\ud658\uc744 \uae30\ubc18\uc73c\ub85c \ud558\ubbc0\ub85c, \ube44\uc120\ud615\uc801\uc778 \uad6c\uc870\ub97c \uc798 \uc124\uba85\ud558\uc9c0 \ubabb\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\ud45c\uc900\ud654 \ud544\uc694<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ubcc0\uc218\ub4e4\uc758 \ub2e8\uc704\ub098 \ubc94\uc704\uac00 \ub2e4\ub97c \uacbd\uc6b0, \ud45c\uc900\ud654\uac00 \ud544\uc694\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\uc8fc\uc131\ubd84 \ubd84\uc11d\uc740 \ub370\uc774\ud130\uc758 \ucc28\uc6d0\uc744 \ucd95\uc18c\ud558\uace0, \uc911\uc694\ud55c \ud328\ud134\uc744 \ubc1c\uacac\ud558\ub294 \ub370 \uc720\uc6a9\ud55c \uae30\ubc95\uc785\ub2c8\ub2e4. \uc774\ub97c \ud1b5\ud574 \ub370\uc774\ud130\uc758 \uad6c\uc870\ub97c \uc774\ud574\ud558\uace0, \ub2e4\uc591\ud55c \ubd84\uc11d \ubc0f \uba38\uc2e0\ub7ec\ub2dd \uae30\ubc95\uc5d0 \ud65c\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"5\" src=\"http:\/\/www.ohsumin.com\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-21-1024x5.jpg\" alt=\"\" class=\"wp-image-1186\" srcset=\"http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-21-1024x5.jpg 1024w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-21-300x1.jpg 300w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-21-768x4.jpg 768w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-21-1536x7.jpg 1536w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-21-2048x10.jpg 2048w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-21-1320x6.jpg 1320w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-21-920x4.jpg 920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%EC%A3%BC%EC%84%B1%EB%B6%84_%EB%B6%84%EC%84%9D_%EB%B0%A9%EB%B2%95\"><\/span>\uc8fc\uc131\ubd84 \ubd84\uc11d \ubc29\ubc95<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\uc8fc\uc131\ubd84 \ubd84\uc11d(PCA, Principal Component Analysis)\uc740 \ub370\uc774\ud130\uc758 \uc8fc\uc694 \ubcc0\ub3d9\uc131\uc744 \uc124\uba85\ud558\ub294 \uc8fc\uc131\ubd84\uc744 \ucc3e\uace0, \uc774\ub97c \ud1b5\ud574 \uace0\ucc28\uc6d0 \ub370\uc774\ud130\ub97c \uc800\ucc28\uc6d0\uc73c\ub85c \ucd95\uc18c\ud558\ub294 \ubc29\ubc95\uc785\ub2c8\ub2e4. PCA\ub294 \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud55c \ubcf4\uc874\ud558\uba74\uc11c, \uc8fc\uc694 \ud2b9\uc131\uc744 \uc720\uc9c0\ud558\uace0, \ucc28\uc6d0\uc744 \ucd95\uc18c\ud558\uc5ec \ub370\uc774\ud130 \ubd84\uc11d\uc744 \uc6a9\uc774\ud558\uac8c \ub9cc\ub4ed\ub2c8\ub2e4. \ub2e4\uc74c\uc740 PCA\uc758 \uc808\ucc28\uc640 \ubc29\ubc95\uc744 \ub2e8\uacc4\ubcc4\ub85c \uc124\uba85\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"PCA%EC%9D%98_%EB%8B%A8%EA%B3%84\"><\/span>PCA\uc758 \ub2e8\uacc4<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\ub370\uc774\ud130 \ud45c\uc900\ud654<\/strong><\/li>\n\n\n\n<li><strong>\uacf5\ubd84\uc0b0 \ud589\ub82c \uacc4\uc0b0<\/strong><\/li>\n\n\n\n<li><strong>\uace0\uc720\uac12\uacfc \uace0\uc720\ubca1\ud130 \uacc4\uc0b0<\/strong><\/li>\n\n\n\n<li><strong>\uc8fc\uc131\ubd84 \uc120\ud0dd<\/strong><\/li>\n\n\n\n<li><strong>\ub370\uc774\ud130 \ubcc0\ud658<\/strong><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_%EB%8D%B0%EC%9D%B4%ED%84%B0_%ED%91%9C%EC%A4%80%ED%99%94\"><\/span>1. \ub370\uc774\ud130 \ud45c\uc900\ud654<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">PCA\ub97c \uc801\uc6a9\ud558\uae30 \uc804\uc5d0 \ub370\uc774\ud130 \ud45c\uc900\ud654\ub294 \uc911\uc694\ud55c \ub2e8\uacc4\uc785\ub2c8\ub2e4. \uc774\ub294 \uac01 \ubcc0\uc218(\ud2b9\uc131)\uc758 \ud3c9\uade0\uc744 0, \ubd84\uc0b0\uc744 1\ub85c \ubcc0\ud658\ud558\ub294 \uacfc\uc815\uc785\ub2c8\ub2e4. \ub370\uc774\ud130\uac00 \ub2e4\ub978 \ub2e8\uc704\ub97c \uac00\uc9c0\uac70\ub098 \ud06c\uae30 \ucc28\uc774\uac00 \uc788\uc744 \uacbd\uc6b0, \ud45c\uc900\ud654\ub294 \uacf5\uc815\ud55c \ube44\uad50\ub97c \uac00\ub2a5\ud558\uac8c \ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\\[<br>X_{\\text{standardized}} = \\frac{X &#8211; \\mu}{\\sigma}<br>\\]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uc5ec\uae30\uc11c \\( X \\)\ub294 \uc6d0\ubcf8 \ub370\uc774\ud130, \\( \\mu \\)\ub294 \uac01 \ubcc0\uc218\uc758 \ud3c9\uade0, \\( \\sigma \\)\ub294 \uac01 \ubcc0\uc218\uc758 \ud45c\uc900\ud3b8\ucc28\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_%EA%B3%B5%EB%B6%84%EC%82%B0_%ED%96%89%EB%A0%AC_%EA%B3%84%EC%82%B0\"><\/span>2. \uacf5\ubd84\uc0b0 \ud589\ub82c \uacc4\uc0b0<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\ud45c\uc900\ud654\ub41c \ub370\uc774\ud130\uc758 \uacf5\ubd84\uc0b0 \ud589\ub82c\uc744 \uacc4\uc0b0\ud569\ub2c8\ub2e4. \uacf5\ubd84\uc0b0 \ud589\ub82c\uc740 \ubcc0\uc218 \uac04\uc758 \ubd84\uc0b0\uacfc \uacf5\ubd84\uc0b0\uc744 \ub098\ud0c0\ub0b4\uba70, \ub370\uc774\ud130\uc758 \ubd84\uc0b0 \uad6c\uc870\ub97c \uc774\ud574\ud558\ub294 \ub370 \ub3c4\uc6c0\uc744 \uc90d\ub2c8\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\\[<br>\\mathbf{Cov} = \\frac{1}{n-1} \\sum_{i=1}^n (X_i &#8211; \\bar{X})(X_i &#8211; \\bar{X})^T<br>\\]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uc5ec\uae30\uc11c \\( X_i \\)\ub294 \\( i \\)\ubc88\uc9f8 \ud45c\ubcf8, \\( \\bar{X} \\)\ub294 \ud3c9\uade0 \ubca1\ud130\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_%EA%B3%A0%EC%9C%A0%EA%B0%92%EA%B3%BC_%EA%B3%A0%EC%9C%A0%EB%B2%A1%ED%84%B0_%EA%B3%84%EC%82%B0\"><\/span>3. \uace0\uc720\uac12\uacfc \uace0\uc720\ubca1\ud130 \uacc4\uc0b0<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\uacf5\ubd84\uc0b0 \ud589\ub82c\uc758 \uace0\uc720\uac12(eigenvalues)\uacfc \uace0\uc720\ubca1\ud130(eigenvectors)\ub97c \uacc4\uc0b0\ud569\ub2c8\ub2e4. \uace0\uc720\uac12\uc740 \uc8fc\uc131\ubd84\uc758 \uc911\uc694\ub3c4\ub97c \ub098\ud0c0\ub0b4\uace0, \uace0\uc720\ubca1\ud130\ub294 \uc8fc\uc131\ubd84\uc758 \ubc29\ud5a5\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\\[<br>\\mathbf{Cov} \\mathbf{v} = \\lambda \\mathbf{v}<br>\\]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uc5ec\uae30\uc11c \\( \\mathbf{v} \\)\ub294 \uace0\uc720\ubca1\ud130, \\( \\lambda \\)\ub294 \uace0\uc720\uac12\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_%EC%A3%BC%EC%84%B1%EB%B6%84_%EC%84%A0%ED%83%9D\"><\/span>4. \uc8fc\uc131\ubd84 \uc120\ud0dd<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\uace0\uc720\uac12\uc758 \ud06c\uae30\uc5d0 \ub530\ub77c \uc8fc\uc131\ubd84\uc744 \uc120\ud0dd\ud569\ub2c8\ub2e4. \uace0\uc720\uac12\uc774 \ud070 \uc8fc\uc131\ubd84\uc77c\uc218\ub85d \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ub9ce\uc774 \uc124\uba85\ud569\ub2c8\ub2e4. \uc77c\ubc18\uc801\uc73c\ub85c \ub204\uc801 \uc124\uba85 \ubd84\uc0b0 \ube44\uc728\uc774 70-90% \uc774\uc0c1\uc774 \ub418\ub294 \uc8fc\uc131\ubd84\uc744 \uc120\ud0dd\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\\[<br>\\text{Explained Variance Ratio} = \\frac{\\lambda_i}{\\sum \\lambda}<br>\\]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uc5ec\uae30\uc11c ( \\lambda_i )\ub294 ( i )\ubc88\uc9f8 \uace0\uc720\uac12\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_%EB%8D%B0%EC%9D%B4%ED%84%B0_%EB%B3%80%ED%99%98\"><\/span>5. \ub370\uc774\ud130 \ubcc0\ud658<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\uc120\ud0dd\ud55c \uc8fc\uc131\ubd84\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc6d0\ubcf8 \ub370\uc774\ud130\ub97c \uc0c8\ub85c\uc6b4 \uc8fc\uc131\ubd84 \uacf5\uac04\uc73c\ub85c \ubcc0\ud658\ud569\ub2c8\ub2e4. \uc774 \ubcc0\ud658\ub41c \ub370\uc774\ud130\ub294 \uc800\ucc28\uc6d0 \uacf5\uac04\uc5d0\uc11c \uc6d0\ubcf8 \ub370\uc774\ud130\uc758 \uc8fc\uc694 \ud2b9\uc131\uc744 \uc720\uc9c0\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">[<br>\\mathbf{Z} = \\mathbf{X} \\mathbf{W}<br>]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uc5ec\uae30\uc11c ( \\mathbf{Z} )\ub294 \uc8fc\uc131\ubd84\uc73c\ub85c \ubcc0\ud658\ub41c \ub370\uc774\ud130, ( \\mathbf{X} )\ub294 \ud45c\uc900\ud654\ub41c \uc6d0\ubcf8 \ub370\uc774\ud130, ( \\mathbf{W} )\ub294 \uc120\ud0dd\ub41c \uc8fc\uc131\ubd84(\uace0\uc720\ubca1\ud130)\ub85c \uc774\ub8e8\uc5b4\uc9c4 \ud589\ub82c\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"PCA%EC%9D%98_%EC%98%88%EC%8B%9C_Python_%EC%BD%94%EB%93%9C-2\"><\/span>PCA\uc758 \uc608\uc2dc (Python \ucf54\ub4dc)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\ub2e4\uc74c\uc740 PCA\ub97c Python\uc744 \uc0ac\uc6a9\ud558\uc5ec \uad6c\ud604\ud558\ub294 \uac04\ub2e8\ud55c \uc608\uc2dc\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport pandas as pd\nfrom sklearn.decomposition import PCA\nimport matplotlib.pyplot as plt\n\n# \uc608\uc2dc \ub370\uc774\ud130 \uc0dd\uc131\nnp.random.seed(0)\ndata = np.random.randn(100, 5)  # 100\uac1c\uc758 \uc0d8\ud50c\uacfc 5\uac1c\uc758 \ud2b9\uc131\n\n# \ub370\uc774\ud130\ud504\ub808\uc784\uc73c\ub85c \ubcc0\ud658\ndf = pd.DataFrame(data, columns=&#091;'Feature1', 'Feature2', 'Feature3', 'Feature4', 'Feature5'])\n\n# \ub370\uc774\ud130 \ud45c\uc900\ud654\ndf_standardized = (df - df.mean()) \/ df.std()\n\n# PCA \ubaa8\ub378 \uc0dd\uc131 \ubc0f \ud559\uc2b5\npca = PCA(n_components=2)\nprincipal_components = pca.fit_transform(df_standardized)\n\n# \uc8fc\uc131\ubd84 \ub370\uc774\ud130\ud504\ub808\uc784 \uc0dd\uc131\ndf_pca = pd.DataFrame(data=principal_components, columns=&#091;'Principal Component 1', 'Principal Component 2'])\n\n# \uc8fc\uc131\ubd84 \ubd84\uc11d \uacb0\uacfc \uc2dc\uac01\ud654\nplt.figure(figsize=(10, 6))\nplt.scatter(df_pca&#091;'Principal Component 1'], df_pca&#091;'Principal Component 2'])\nplt.xlabel('Principal Component 1')\nplt.ylabel('Principal Component 2')\nplt.title('PCA Result')\nplt.grid(True)\nplt.show()\n\n# \uc124\uba85\ub41c \ubd84\uc0b0 \ube44\uc728 \ucd9c\ub825\nprint('Explained Variance Ratio:', pca.explained_variance_ratio_)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%EA%B2%B0%EA%B3%BC_%ED%95%B4%EC%84%9D-2\"><\/span>\uacb0\uacfc \ud574\uc11d<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\ubd84\uc0b0 \uc124\uba85 \ube44\uc728 (Explained Variance Ratio)<\/strong>:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>pca.explained_variance_ratio_<\/code>\ub294 \uac01 \uc8fc\uc131\ubd84\uc774 \uc804\uccb4 \ubd84\uc0b0\uc5d0\uc11c \ucc28\uc9c0\ud558\ub294 \ube44\uc728\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4.<\/li>\n\n\n\n<li>\uc608\ub97c \ub4e4\uc5b4, \uccab \ubc88\uc9f8 \uc8fc\uc131\ubd84\uc774 70%\uc758 \ubd84\uc0b0\uc744 \uc124\uba85\ud558\uace0, \ub450 \ubc88\uc9f8 \uc8fc\uc131\ubd84\uc774 20%\uc758 \ubd84\uc0b0\uc744 \uc124\uba85\ud558\uba74, \uc774 \ub450 \uc8fc\uc131\ubd84\uc774 \uc804\uccb4 \ubd84\uc0b0\uc758 90%\ub97c \uc124\uba85\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\uc2dc\uac01\ud654<\/strong>:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc8fc\uc131\ubd84 \ubd84\uc11d \uacb0\uacfc\ub97c 2D \ud3c9\uba74\uc5d0 \uc2dc\uac01\ud654\ud558\uc5ec, \ub370\uc774\ud130\uc758 \uc8fc\uc694 \uad6c\uc870\uc640 \ud328\ud134\uc744 \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n\n\n\n<li>\uac01 \uc810\uc740 \ubcc0\ud658\ub41c \ub370\uc774\ud130 \ud3ec\uc778\ud2b8\ub97c \ub098\ud0c0\ub0b4\uba70, \uc8fc\uc131\ubd84 \uacf5\uac04\uc5d0\uc11c\uc758 \uc704\uce58\ub97c \ubcf4\uc5ec\uc90d\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%EC%9A%94%EC%95%BD\"><\/span>\uc694\uc57d<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">PCA\ub294 \ub370\uc774\ud130\uc758 \ucc28\uc6d0\uc744 \ucd95\uc18c\ud558\uace0, \uc911\uc694\ud55c \ud328\ud134\uc744 \ubc1c\uacac\ud558\ub294 \ub370 \uc720\uc6a9\ud55c \uae30\ubc95\uc785\ub2c8\ub2e4. \uc774\ub97c \ud1b5\ud574 \ub370\uc774\ud130\uc758 \uad6c\uc870\ub97c \uc774\ud574\ud558\uace0, \ub2e4\uc591\ud55c \ubd84\uc11d \ubc0f \uba38\uc2e0\ub7ec\ub2dd \uae30\ubc95\uc5d0 \ud65c\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"5\" src=\"http:\/\/www.ohsumin.com\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-1024x5.jpg\" alt=\"\" class=\"wp-image-1185\" srcset=\"http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-1024x5.jpg 1024w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-300x1.jpg 300w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-768x4.jpg 768w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-1536x7.jpg 1536w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-2048x10.jpg 2048w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-1320x6.jpg 1320w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-920x4.jpg 920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%EC%A3%BC%EC%84%B1%EB%B6%84_%EB%B6%84%EC%84%9D_%EC%98%88%EC%8B%9C\"><\/span>\uc8fc\uc131\ubd84 \ubd84\uc11d \uc608\uc2dc <span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\ub2e4\uc74c\uc740 PCA\ub97c \uc0ac\uc6a9\ud558\uc5ec \ubcf4\ub2e4 \uad6c\uccb4\uc801\uc778 \uc608\uc2dc\ub97c \ubcf4\uc5ec\uc8fc\ub294 \uc608\uc785\ub2c8\ub2e4. \uc774 \uc608\uc81c\uc5d0\uc11c\ub294 \ub354 \ubcf5\uc7a1\ud55c \ub370\uc774\ud130\ub97c \uc0ac\uc6a9\ud558\uc5ec PCA\ub97c \uc801\uc6a9\ud558\uace0, \uacb0\uacfc\ub97c \ud574\uc11d\ud558\ub294 \ubc29\ubc95\uc744 \uc124\uba85\ud569\ub2c8\ub2e4. \uc0ac\uc6a9\ub418\ub294 \ub370\uc774\ud130\uc14b\uc740 <code>Iris<\/code> \ub370\uc774\ud130\uc14b\uc73c\ub85c, \uc138 \uac00\uc9c0 \ud488\uc885\uc758 \uaf43\uc744 \ub2e4\uc591\ud55c \ud2b9\uc131\uc73c\ub85c \uad6c\ubd84\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_%EB%8D%B0%EC%9D%B4%ED%84%B0%EC%85%8B_%EC%84%A4%EB%AA%85\"><\/span>1. \ub370\uc774\ud130\uc14b \uc124\uba85<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Iris<\/code> \ub370\uc774\ud130\uc14b\uc740 \ub2e4\uc74c\uacfc \uac19\uc740 \ud2b9\uc131\uc744 \ud3ec\ud568\ud569\ub2c8\ub2e4:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Sepal Length<\/strong> (\uaf43\ubc1b\uce68 \uae38\uc774)<\/li>\n\n\n\n<li><strong>Sepal Width<\/strong> (\uaf43\ubc1b\uce68 \ub108\ube44)<\/li>\n\n\n\n<li><strong>Petal Length<\/strong> (\uaf43\uc78e \uae38\uc774)<\/li>\n\n\n\n<li><strong>Petal Width<\/strong> (\uaf43\uc78e \ub108\ube44)<\/li>\n\n\n\n<li><strong>Species<\/strong> (\ud488\uc885)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_%EB%8D%B0%EC%9D%B4%ED%84%B0_%EC%A4%80%EB%B9%84_%EB%B0%8F_PCA_%EC%A0%81%EC%9A%A9\"><\/span>2. \ub370\uc774\ud130 \uc900\ube44 \ubc0f PCA \uc801\uc6a9<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom sklearn.datasets import load_iris\nfrom sklearn.decomposition import PCA\nfrom sklearn.preprocessing import StandardScaler\n\n# Iris \ub370\uc774\ud130\uc14b \ub85c\ub4dc\niris = load_iris()\nX = iris.data\ny = iris.target\ntarget_names = iris.target_names\n\n# \ub370\uc774\ud130\ud504\ub808\uc784\uc73c\ub85c \ubcc0\ud658\ndf = pd.DataFrame(X, columns=iris.feature_names)\ndf&#091;'Species'] = pd.Categorical.from_codes(y, target_names)\n\n# \ub370\uc774\ud130 \ud45c\uc900\ud654\nscaler = StandardScaler()\nX_standardized = scaler.fit_transform(X)\n\n# PCA \ubaa8\ub378 \uc0dd\uc131 \ubc0f \ud559\uc2b5\npca = PCA(n_components=2)\nprincipal_components = pca.fit_transform(X_standardized)\n\n# \uc8fc\uc131\ubd84 \ub370\uc774\ud130\ud504\ub808\uc784 \uc0dd\uc131\ndf_pca = pd.DataFrame(data=principal_components, columns=&#091;'Principal Component 1', 'Principal Component 2'])\ndf_pca&#091;'Species'] = df&#091;'Species']\n\n# PCA \uacb0\uacfc \uc2dc\uac01\ud654\nplt.figure(figsize=(10, 6))\ncolors = &#091;'navy', 'turquoise', 'darkorange']\nlw = 2\n\nfor color, target_name in zip(colors, target_names):\n    plt.scatter(df_pca.loc&#091;df_pca&#091;'Species'] == target_name, 'Principal Component 1'],\n                df_pca.loc&#091;df_pca&#091;'Species'] == target_name, 'Principal Component 2'],\n                color=color, alpha=0.8, lw=lw,\n                label=target_name)\n\nplt.legend(loc='best', shadow=False, scatterpoints=1)\nplt.title('PCA of IRIS dataset')\nplt.xlabel('Principal Component 1')\nplt.ylabel('Principal Component 2')\nplt.grid(True)\nplt.show()\n\n# \uc124\uba85\ub41c \ubd84\uc0b0 \ube44\uc728 \ucd9c\ub825\nprint('Explained Variance Ratio:', pca.explained_variance_ratio_)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_%EA%B2%B0%EA%B3%BC_%ED%95%B4%EC%84%9D\"><\/span>3. \uacb0\uacfc \ud574\uc11d<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\ubd84\uc0b0 \uc124\uba85 \ube44\uc728 (Explained Variance Ratio)<\/strong>:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>pca.explained_variance_ratio_<\/code>\ub294 \uac01 \uc8fc\uc131\ubd84\uc774 \uc804\uccb4 \ubd84\uc0b0\uc5d0\uc11c \ucc28\uc9c0\ud558\ub294 \ube44\uc728\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4.<\/li>\n\n\n\n<li>\uc608\ub97c \ub4e4\uc5b4, \uccab \ubc88\uc9f8 \uc8fc\uc131\ubd84\uc774 72.77%\uc758 \ubd84\uc0b0\uc744 \uc124\uba85\ud558\uace0, \ub450 \ubc88\uc9f8 \uc8fc\uc131\ubd84\uc774 23.03%\uc758 \ubd84\uc0b0\uc744 \uc124\uba85\ud558\uba74, \uc774 \ub450 \uc8fc\uc131\ubd84\uc774 \uc804\uccb4 \ubd84\uc0b0\uc758 95.80%\ub97c \uc124\uba85\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>Explained Variance Ratio: &#091;0.72770452 0.23030523]<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li><strong>\uc2dc\uac01\ud654<\/strong>:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc8fc\uc131\ubd84 \ubd84\uc11d \uacb0\uacfc\ub97c 2D \ud3c9\uba74\uc5d0 \uc2dc\uac01\ud654\ud558\uc5ec, \ub370\uc774\ud130\uc758 \uc8fc\uc694 \uad6c\uc870\uc640 \ud328\ud134\uc744 \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n\n\n\n<li>\uac01 \uc810\uc740 \ubcc0\ud658\ub41c \ub370\uc774\ud130 \ud3ec\uc778\ud2b8\ub97c \ub098\ud0c0\ub0b4\uba70, \uc0c9\uc0c1\uc740 \uc11c\ub85c \ub2e4\ub978 \ud488\uc885\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4.<\/li>\n\n\n\n<li>\uccab \ubc88\uc9f8 \uc8fc\uc131\ubd84\uacfc \ub450 \ubc88\uc9f8 \uc8fc\uc131\ubd84\uc73c\ub85c \ubcc0\ud658\ub41c \ub370\uc774\ud130 \ud3ec\uc778\ud2b8\ub97c \ud1b5\ud574 \uac01 \ud488\uc885 \uac04\uc758 \ucc28\uc774\ub97c \uc2dc\uac01\uc801\uc73c\ub85c \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\uc774 \uc608\uc2dc\ub294 PCA\ub97c \ud1b5\ud574 \uace0\ucc28\uc6d0 \ub370\uc774\ud130\ub97c \uc800\ucc28\uc6d0\uc73c\ub85c \ucd95\uc18c\ud558\uace0, \uc2dc\uac01\ud654\ub97c \ud1b5\ud574 \ub370\uc774\ud130\uc758 \uc8fc\uc694 \uad6c\uc870\ub97c \uc774\ud574\ud558\ub294 \ubc29\ubc95\uc744 \ubcf4\uc5ec\uc90d\ub2c8\ub2e4. PCA\ub294 \ud2b9\ud788 \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud55c \ubcf4\uc874\ud558\uba74\uc11c \ucc28\uc6d0\uc744 \ucd95\uc18c\ud558\ub294 \ub370 \uc720\uc6a9\ud558\uba70, \uc774\ub97c \ud1b5\ud574 \ub370\uc774\ud130 \ubd84\uc11d \ubc0f \uc2dc\uac01\ud654\uc758 \ud6a8\uc728\uc131\uc744 \ub192\uc77c \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"5\" src=\"http:\/\/www.ohsumin.com\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-1024x5.jpg\" alt=\"\" class=\"wp-image-1185\" srcset=\"http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-1024x5.jpg 1024w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-300x1.jpg 300w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-768x4.jpg 768w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-1536x7.jpg 1536w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-2048x10.jpg 2048w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-1320x6.jpg 1320w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-20-920x4.jpg 920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"PCA_ICA_%EB%B9%84%EA%B5%90\"><\/span>PCA &amp; ICA \ube44\uad50<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\uc8fc\uc131\ubd84 \ubd84\uc11d(PCA, Principal Component Analysis)\uc640 \ub3c5\ub9bd \uc131\ubd84 \ubd84\uc11d(ICA, Independent Component Analysis)\ub294 \ubaa8\ub450 \uace0\ucc28\uc6d0 \ub370\uc774\ud130\ub97c \uc800\ucc28\uc6d0\uc73c\ub85c \ucd95\uc18c\ud558\uac70\ub098 \ub370\uc774\ud130\ub97c \ubcc0\ud658\ud558\ub294 \uae30\ubc95\uc785\ub2c8\ub2e4. \uadf8\ub7ec\ub098 \uadf8\ub4e4\uc758 \ubaa9\uc801, \uc801\uc6a9 \ubc29\ubc95, \uadf8\ub9ac\uace0 \ub370\uc774\ud130 \ubcc0\ud658\uc758 \ud2b9\uc131\uc5d0\uc11c \uc911\uc694\ud55c \ucc28\uc774\uc810\uc774 \uc788\uc2b5\ub2c8\ub2e4. \uc544\ub798\ub294 PCA\uc640 ICA\uc758 \uc8fc\uc694 \ucc28\uc774\uc810\uc744 \uc124\uba85\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_%EB%AA%A9%EC%A0%81%EA%B3%BC_%EB%AA%A9%ED%91%9C\"><\/span>1. \ubaa9\uc801\uacfc \ubaa9\ud45c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PCA (Principal Component Analysis)<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ubaa9\uc801<\/strong>: \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud55c \ubcf4\uc874\ud558\uba74\uc11c \uace0\ucc28\uc6d0 \ub370\uc774\ud130\ub97c \uc800\ucc28\uc6d0\uc73c\ub85c \ucd95\uc18c\ud558\ub294 \uac83\uc785\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\ubaa9\ud45c<\/strong>: \ub370\uc774\ud130\uc758 \uc8fc\uc694 \ubcc0\ub3d9\uc131\uc744 \uc124\uba85\ud558\ub294 \uc9c1\uad50(orthogonal) \uc8fc\uc131\ubd84\uc744 \ucc3e\ub294 \uac83\uc785\ub2c8\ub2e4. \uac01 \uc8fc\uc131\ubd84\uc740 \ucd5c\ub300\ud55c\uc758 \ubd84\uc0b0\uc744 \uac00\uc9c0\uba70, \uc11c\ub85c \uc9c1\uad50\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ICA (Independent Component Analysis)<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ubaa9\uc801<\/strong>: \uc11c\ub85c \ud1b5\uacc4\uc801\uc73c\ub85c \ub3c5\ub9bd\uc801\uc778 \uc131\ubd84\uc744 \ucd94\ucd9c\ud558\ub294 \uac83\uc785\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\ubaa9\ud45c<\/strong>: \ub370\uc774\ud130\uc758 \uc6d0\ucc9c \uc2e0\ud638\ub97c \ubcf5\uc6d0\ud558\ub294 \uac83\uc785\ub2c8\ub2e4. \uc774\ub294 \ud2b9\ud788 \uc2e0\ud638 \ucc98\ub9ac, \uc774\ubbf8\uc9c0 \ubcf5\uc6d0, \ub1cc\ud30c \ubd84\uc11d \ub4f1\uc5d0\uc11c \uc911\uc694\ud55c \uc5ed\ud560\uc744 \ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_%EB%8D%B0%EC%9D%B4%ED%84%B0_%EB%B3%80%ED%99%98_%EB%B0%A9%EB%B2%95\"><\/span>2. \ub370\uc774\ud130 \ubcc0\ud658 \ubc29\ubc95<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PCA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ubcc0\ud658<\/strong>: \uacf5\ubd84\uc0b0 \ud589\ub82c\uc758 \uace0\uc720\uac12\uacfc \uace0\uc720\ubca1\ud130\ub97c \uc0ac\uc6a9\ud558\uc5ec \ub370\uc774\ud130\ub97c \ubcc0\ud658\ud569\ub2c8\ub2e4. \uc8fc\uc131\ubd84\uc740 \ub370\uc774\ud130\uc758 \ucd5c\ub300 \ubd84\uc0b0 \ubc29\ud5a5\uc744 \ub530\ub985\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\uacb0\uacfc<\/strong>: \uc8fc\uc131\ubd84\uc740 \uc11c\ub85c \uc9c1\uad50\ud558\uba70, \uc6d0\ub798 \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud55c \uc124\uba85\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ICA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ubcc0\ud658<\/strong>: \ud1b5\uacc4\uc801 \ub3c5\ub9bd\uc131\uc744 \uadf9\ub300\ud654\ud558\ub294 \ubc29\ud5a5\uc744 \ucc3e\uc2b5\ub2c8\ub2e4. \uc8fc\ub85c \ube44\uc120\ud615 \ucd5c\uc801\ud654 \uae30\ubc95\uc744 \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\uacb0\uacfc<\/strong>: \ub3c5\ub9bd \uc131\ubd84\uc740 \uc11c\ub85c \ud1b5\uacc4\uc801\uc73c\ub85c \ub3c5\ub9bd\uc801\uc785\ub2c8\ub2e4. \uc774\ub294 \uace0\ucc28\uc6d0 \ub370\uc774\ud130\uc5d0\uc11c \uc11c\ub85c \ub3c5\ub9bd\uc801\uc778 \uc2e0\ud638\ub098 \ud2b9\uc9d5\uc744 \ubd84\ub9ac\ud558\ub294 \ub370 \uc720\uc6a9\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_%EA%B0%80%EC%A0%95\"><\/span>3. \uac00\uc815<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PCA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\uc120\ud615\uc131<\/strong>: \ub370\uc774\ud130\uc758 \uad6c\uc870\uac00 \uc120\ud615\uc801\uc774\ub77c\ub294 \uac00\uc815\uc744 \ud569\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\uc815\uaddc\uc131<\/strong>: \ub370\uc774\ud130\uac00 \ub2e4\ubcc0\ub7c9 \uc815\uaddc \ubd84\ud3ec\ub97c \ub530\ub978\ub2e4\ub294 \uac00\uc815\uc744 \uc554\ubb35\uc801\uc73c\ub85c \ud3ec\ud568\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ICA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ub3c5\ub9bd\uc131<\/strong>: \uac01 \uc131\ubd84\uc774 \uc11c\ub85c \ud1b5\uacc4\uc801\uc73c\ub85c \ub3c5\ub9bd\uc801\uc774\ub77c\ub294 \uac00\uc815\uc744 \ud569\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\ube44\uc815\uaddc\uc131<\/strong>: \ub370\uc774\ud130\uac00 \uc815\uaddc \ubd84\ud3ec\ub97c \ub530\ub974\uc9c0 \uc54a\ub294\ub2e4\uace0 \uac00\uc815\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_%EA%B2%B0%EA%B3%BC%EC%9D%98_%ED%95%B4%EC%84%9D\"><\/span>4. \uacb0\uacfc\uc758 \ud574\uc11d<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PCA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\uc8fc\uc131\ubd84<\/strong>: \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud55c \uc124\uba85\ud558\ub294 \uc9c1\uad50 \uc131\ubd84.<\/li>\n\n\n\n<li><strong>\ud574\uc11d<\/strong>: \uc8fc\uc131\ubd84\uc740 \ub370\uc774\ud130\uc758 \uc8fc\uc694 \ubcc0\ub3d9 \ubc29\ud5a5\uc744 \ub098\ud0c0\ub0b4\uba70, \ubd84\uc0b0 \ube44\uc728\ub85c \uc124\uba85\ub429\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ICA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ub3c5\ub9bd \uc131\ubd84<\/strong>: \uc11c\ub85c \ub3c5\ub9bd\uc801\uc778 \uc131\ubd84.<\/li>\n\n\n\n<li><strong>\ud574\uc11d<\/strong>: \uac01 \uc131\ubd84\uc740 \uc6d0\ucc9c \uc2e0\ud638\ub97c \ub098\ud0c0\ub0b4\uba70, \uc8fc\ub85c \uc2e0\ud638 \ucc98\ub9ac\uc5d0\uc11c \uc6d0 \uc2e0\ud638\ub97c \ubcf5\uc6d0\ud558\ub294 \ub370 \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_%EC%9D%91%EC%9A%A9_%EB%B6%84%EC%95%BC\"><\/span>5. \uc751\uc6a9 \ubd84\uc57c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PCA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ucc28\uc6d0 \ucd95\uc18c<\/strong>: \uace0\ucc28\uc6d0 \ub370\uc774\ud130\ub97c \uc800\ucc28\uc6d0\uc73c\ub85c \ucd95\uc18c\ud558\uc5ec \uc2dc\uac01\ud654, \ub178\uc774\uc988 \uac10\uc18c, \ub370\uc774\ud130 \uc555\ucd95 \ub4f1\uc5d0 \uc0ac\uc6a9.<\/li>\n\n\n\n<li><strong>\ub370\uc774\ud130 \uc804\ucc98\ub9ac<\/strong>: \ubcc0\uc218 \uac04\uc758 \uc0c1\uad00 \uad00\uacc4\ub97c \uc81c\uac70\ud558\uc5ec \ubd84\uc11d \ubc0f \ubaa8\ub378\ub9c1\uc758 \ud6a8\uc728\uc131\uc744 \ub192\uc785\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\uc774\ubbf8\uc9c0 \uc555\ucd95<\/strong>: \uc774\ubbf8\uc9c0 \ub370\uc774\ud130\uc758 \ucc28\uc6d0\uc744 \ucd95\uc18c\ud558\uc5ec \uc800\uc7a5 \uacf5\uac04\uc744 \uc904\uc774\uace0, \ucc98\ub9ac \uc18d\ub3c4\ub97c \ud5a5\uc0c1\uc2dc\ud0b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ICA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\uc2e0\ud638 \ubd84\ub9ac<\/strong>: \ud63c\ud569 \uc2e0\ud638\uc5d0\uc11c \uc6d0\ucc9c \uc2e0\ud638\ub97c \ubd84\ub9ac\ud558\ub294 \ub370 \uc0ac\uc6a9. \uc608: \ub1cc\ud30c(EEG) \uc2e0\ud638 \ubd84\uc11d, \uc74c\uc131 \uc2e0\ud638 \ubd84\ub9ac.<\/li>\n\n\n\n<li><strong>\uc774\ubbf8\uc9c0 \ubcf5\uc6d0<\/strong>: \ud63c\ud569\ub41c \uc774\ubbf8\uc9c0\ub97c \uc6d0\ub798\uc758 \ub3c5\ub9bd\uc801\uc778 \uc774\ubbf8\uc9c0\ub85c \ubd84\ub9ac.<\/li>\n\n\n\n<li><strong>\uae08\uc735 \ub370\uc774\ud130 \ubd84\uc11d<\/strong>: \uae08\uc735 \ub370\uc774\ud130\uc758 \ub3c5\ub9bd\uc801\uc778 \uc694\uc18c\ub97c \uc2dd\ubcc4\ud558\uc5ec \uc2dc\uc7a5 \ubd84\uc11d\uc5d0 \uc0ac\uc6a9.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Python_%EC%98%88%EC%8B%9C_%EC%BD%94%EB%93%9C\"><\/span>Python \uc608\uc2dc \ucf54\ub4dc<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\uc544\ub798\ub294 PCA\uc640 ICA\ub97c \uac01\uac01 \uc218\ud589\ud558\ub294 \uac04\ub2e8\ud55c Python \uc608\uc2dc\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport pandas as pd\nfrom sklearn.decomposition import PCA, FastICA\nimport matplotlib.pyplot as plt\n\n# \uc608\uc2dc \ub370\uc774\ud130 \uc0dd\uc131\nnp.random.seed(0)\ndata = np.random.randn(100, 5)  # 100\uac1c\uc758 \uc0d8\ud50c\uacfc 5\uac1c\uc758 \ud2b9\uc131\n\n# \ub370\uc774\ud130\ud504\ub808\uc784\uc73c\ub85c \ubcc0\ud658\ndf = pd.DataFrame(data, columns=&#091;'Feature1', 'Feature2', 'Feature3', 'Feature4', 'Feature5'])\n\n# PCA\npca = PCA(n_components=2)\npca_components = pca.fit_transform(df)\n\n# ICA\nica = FastICA(n_components=2)\nica_components = ica.fit_transform(df)\n\n# PCA \uacb0\uacfc \uc2dc\uac01\ud654\nplt.figure(figsize=(12, 6))\n\nplt.subplot(1, 2, 1)\nplt.scatter(pca_components&#091;:, 0], pca_components&#091;:, 1])\nplt.title('PCA Result')\nplt.xlabel('Principal Component 1')\nplt.ylabel('Principal Component 2')\nplt.grid(True)\n\n# ICA \uacb0\uacfc \uc2dc\uac01\ud654\nplt.subplot(1, 2, 2)\nplt.scatter(ica_components&#091;:, 0], ica_components&#091;:, 1])\nplt.title('ICA Result')\nplt.xlabel('Independent Component 1')\nplt.ylabel('Independent Component 2')\nplt.grid(True)\n\nplt.show()<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%EA%B2%B0%EA%B3%BC_%ED%95%B4%EC%84%9D-3\"><\/span>\uacb0\uacfc \ud574\uc11d<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>PCA \uacb0\uacfc<\/strong>: \uc8fc\uc131\ubd84 \uacf5\uac04\uc5d0\uc11c \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud654\ud558\ub294 \ubc29\ud5a5\uc73c\ub85c \ubcc0\ud658\ub41c \ub370\uc774\ud130 \ud3ec\uc778\ud2b8.<\/li>\n\n\n\n<li><strong>ICA \uacb0\uacfc<\/strong>: \ud1b5\uacc4\uc801\uc73c\ub85c \ub3c5\ub9bd\uc801\uc778 \uc131\ubd84 \uacf5\uac04\uc5d0\uc11c \ubcc0\ud658\ub41c \ub370\uc774\ud130 \ud3ec\uc778\ud2b8.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\uc774 \uc608\uc2dc\ub294 PCA\uc640 ICA\uac00 \uc5b4\ub5bb\uac8c \ub370\uc774\ud130\ub97c \ubcc0\ud658\ud558\ub294\uc9c0, \uadf8\ub9ac\uace0 \uacb0\uacfc\uac00 \uc5b4\ub5bb\uac8c \ub2e4\ub978\uc9c0\ub97c \ubcf4\uc5ec\uc90d\ub2c8\ub2e4. PCA\ub294 \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud654\ud558\ub294 \uc8fc\uc131\ubd84\uc744 \ucc3e\uace0, ICA\ub294 \ub370\uc774\ud130\uc758 \ub3c5\ub9bd\uc801\uc778 \uc131\ubd84\uc744 \ucc3e\ub294 \ub370 \uc911\uc810\uc744 \ub461\ub2c8\ub2e4. \uc774 \ucc28\uc774\ub294 \uac01 \ubc29\ubc95\uc774 \ub370\uc774\ud130 \ubd84\uc11d\uacfc \uc2e0\ud638 \ucc98\ub9ac\uc5d0\uc11c \uc5b4\ub5bb\uac8c \uc0ac\uc6a9\ub418\ub294\uc9c0\uc5d0 \uc601\ud5a5\uc744 \ubbf8\uce69\ub2c8\ub2e4.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"5\" src=\"http:\/\/www.ohsumin.com\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-22-1024x5.jpg\" alt=\"\" class=\"wp-image-1187\" srcset=\"http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-22-1024x5.jpg 1024w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-22-300x1.jpg 300w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-22-768x4.jpg 768w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-22-1536x7.jpg 1536w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-22-2048x10.jpg 2048w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-22-1320x6.jpg 1320w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-22-920x4.jpg 920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"PCA_%EC%99%80_LDA_%EB%B9%84%EA%B5%90\"><\/span>PCA \uc640 LDA \ube44\uad50<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\uc8fc\uc131\ubd84 \ubd84\uc11d(PCA, Principal Component Analysis)\uacfc \uc120\ud615 \ud310\ubcc4 \ubd84\uc11d(LDA, Linear Discriminant Analysis)\ub294 \ubaa8\ub450 \ucc28\uc6d0 \ucd95\uc18c\uc640 \ub370\uc774\ud130 \ubcc0\ud658\uc744 \uc704\ud574 \uc0ac\uc6a9\ub418\ub294 \uae30\ubc95\uc785\ub2c8\ub2e4. \uadf8\ub7ec\ub098 \uadf8\ub4e4\uc758 \ubaa9\uc801, \uc801\uc6a9 \ubc29\ubc95, \uadf8\ub9ac\uace0 \ub370\uc774\ud130 \ubcc0\ud658\uc758 \ud2b9\uc131\uc5d0\uc11c \uc911\uc694\ud55c \ucc28\uc774\uc810\uc774 \uc788\uc2b5\ub2c8\ub2e4. \uc544\ub798\ub294 PCA\uc640 LDA\uc758 \uc8fc\uc694 \ucc28\uc774\uc810\uc744 \uc124\uba85\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_%EB%AA%A9%EC%A0%81%EA%B3%BC_%EB%AA%A9%ED%91%9C-2\"><\/span>1. \ubaa9\uc801\uacfc \ubaa9\ud45c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PCA (Principal Component Analysis)<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ubaa9\uc801<\/strong>: \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud55c \ubcf4\uc874\ud558\uba74\uc11c \uace0\ucc28\uc6d0 \ub370\uc774\ud130\ub97c \uc800\ucc28\uc6d0\uc73c\ub85c \ucd95\uc18c\ud558\ub294 \uac83\uc785\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\ubaa9\ud45c<\/strong>: \ub370\uc774\ud130\uc758 \uc8fc\uc694 \ubcc0\ub3d9\uc131\uc744 \uc124\uba85\ud558\ub294 \uc9c1\uad50 \uc8fc\uc131\ubd84\uc744 \ucc3e\ub294 \uac83\uc785\ub2c8\ub2e4. PCA\ub294 \uc8fc\ub85c \ub370\uc774\ud130\uc758 \uad6c\uc870\ub97c \uc774\ud574\ud558\uace0, \uc2dc\uac01\ud654 \ubc0f \ub178\uc774\uc988 \uac10\uc18c\ub97c \uc704\ud574 \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>LDA (Linear Discriminant Analysis)<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ubaa9\uc801<\/strong>: \ud074\ub798\uc2a4 \uac04\uc758 \ubd84\ub9ac\ub97c \ucd5c\ub300\ud654\ud558\uba74\uc11c \uace0\ucc28\uc6d0 \ub370\uc774\ud130\ub97c \uc800\ucc28\uc6d0\uc73c\ub85c \ucd95\uc18c\ud558\ub294 \uac83\uc785\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\ubaa9\ud45c<\/strong>: \ud074\ub798\uc2a4 \uac04\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud654\ud558\uace0, \ud074\ub798\uc2a4 \ub0b4\uc758 \ubd84\uc0b0\uc744 \ucd5c\uc18c\ud654\ud558\ub294 \ubc29\ud5a5\uc744 \ucc3e\ub294 \uac83\uc785\ub2c8\ub2e4. LDA\ub294 \uc8fc\ub85c \ubd84\ub958 \ubb38\uc81c\uc5d0\uc11c \ud074\ub798\uc2a4 \uac04\uc758 \uad6c\ubd84\uc744 \uba85\ud655\ud788 \ud558\uae30 \uc704\ud574 \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_%EB%8D%B0%EC%9D%B4%ED%84%B0_%EB%B3%80%ED%99%98_%EB%B0%A9%EB%B2%95-2\"><\/span>2. \ub370\uc774\ud130 \ubcc0\ud658 \ubc29\ubc95<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PCA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ubcc0\ud658<\/strong>: \uacf5\ubd84\uc0b0 \ud589\ub82c\uc758 \uace0\uc720\uac12\uacfc \uace0\uc720\ubca1\ud130\ub97c \uc0ac\uc6a9\ud558\uc5ec \ub370\uc774\ud130\ub97c \ubcc0\ud658\ud569\ub2c8\ub2e4. \uc8fc\uc131\ubd84\uc740 \ub370\uc774\ud130\uc758 \ucd5c\ub300 \ubd84\uc0b0 \ubc29\ud5a5\uc744 \ub530\ub985\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\uacb0\uacfc<\/strong>: \uc8fc\uc131\ubd84\uc740 \uc11c\ub85c \uc9c1\uad50\ud558\uba70, \uc6d0\ub798 \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud55c \uc124\uba85\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>LDA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ubcc0\ud658<\/strong>: \ud074\ub798\uc2a4 \uac04\uc758 \ubd84\uc0b0\uacfc \ud074\ub798\uc2a4 \ub0b4\uc758 \ubd84\uc0b0\uc744 \uace0\ub824\ud558\uc5ec, \uac00\uc7a5 \uc798 \ubd84\ub9ac\ub418\ub294 \ubc29\ud5a5\uc744 \ucc3e\uc2b5\ub2c8\ub2e4. \uc774\ub97c \uc704\ud574 \uc0b0\ud3ec \ud589\ub82c(scatter matrix)\uc744 \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\uacb0\uacfc<\/strong>: LDA\ub294 \ud074\ub798\uc2a4 \uac04\uc758 \ubd84\ub9ac\ub97c \ucd5c\ub300\ud654\ud558\ub294 \ubc29\ud5a5\uc744 \ucc3e\uc73c\uba70, \ud074\ub798\uc2a4 \uac04\uc758 \ubd84\uc0b0 \ub300\ube44 \ud074\ub798\uc2a4 \ub0b4\uc758 \ubd84\uc0b0 \ube44\uc728\uc744 \ucd5c\ub300\ud654\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_%EA%B0%80%EC%A0%95-2\"><\/span>3. \uac00\uc815<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PCA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\uc120\ud615\uc131<\/strong>: \ub370\uc774\ud130\uc758 \uad6c\uc870\uac00 \uc120\ud615\uc801\uc774\ub77c\ub294 \uac00\uc815\uc744 \ud569\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\uc815\uaddc\uc131<\/strong>: \ub370\uc774\ud130\uac00 \ub2e4\ubcc0\ub7c9 \uc815\uaddc \ubd84\ud3ec\ub97c \ub530\ub978\ub2e4\ub294 \uac00\uc815\uc744 \uc554\ubb35\uc801\uc73c\ub85c \ud3ec\ud568\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>LDA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\uc815\uaddc\uc131<\/strong>: \uac01 \ud074\ub798\uc2a4\uc758 \ub370\uc774\ud130\uac00 \uc815\uaddc \ubd84\ud3ec\ub97c \ub530\ub978\ub2e4\uace0 \uac00\uc815\ud569\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\ub3d9\uc77c\ud55c \uacf5\ubd84\uc0b0 \ud589\ub82c<\/strong>: \ubaa8\ub4e0 \ud074\ub798\uc2a4\uac00 \ub3d9\uc77c\ud55c \uacf5\ubd84\uc0b0 \ud589\ub82c\uc744 \uac00\uc9c4\ub2e4\uace0 \uac00\uc815\ud569\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\uc120\ud615\uc131<\/strong>: \ud074\ub798\uc2a4 \uac04\uc758 \uacbd\uacc4\uac00 \uc120\ud615\uc801\uc774\ub77c\uace0 \uac00\uc815\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_%EA%B2%B0%EA%B3%BC%EC%9D%98_%ED%95%B4%EC%84%9D-2\"><\/span>4. \uacb0\uacfc\uc758 \ud574\uc11d<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PCA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\uc8fc\uc131\ubd84<\/strong>: \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud55c \uc124\uba85\ud558\ub294 \uc9c1\uad50 \uc131\ubd84.<\/li>\n\n\n\n<li><strong>\ud574\uc11d<\/strong>: \uc8fc\uc131\ubd84\uc740 \ub370\uc774\ud130\uc758 \uc8fc\uc694 \ubcc0\ub3d9 \ubc29\ud5a5\uc744 \ub098\ud0c0\ub0b4\uba70, \ubd84\uc0b0 \ube44\uc728\ub85c \uc124\uba85\ub429\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>LDA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ud310\ubcc4 \ud568\uc218<\/strong>: \ud074\ub798\uc2a4 \uac04\uc758 \ubd84\ub9ac\ub97c \ucd5c\ub300\ud654\ud558\ub294 \uc131\ubd84.<\/li>\n\n\n\n<li><strong>\ud574\uc11d<\/strong>: \ud310\ubcc4 \ud568\uc218\ub294 \ub370\uc774\ud130 \ud3ec\uc778\ud2b8\uac00 \uc18d\ud560 \ud074\ub798\uc2a4\ub97c \uacb0\uc815\ud558\ub294 \uae30\uc900\uc744 \uc81c\uacf5\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_%EC%9D%91%EC%9A%A9_%EB%B6%84%EC%95%BC-2\"><\/span>5. \uc751\uc6a9 \ubd84\uc57c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PCA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ucc28\uc6d0 \ucd95\uc18c<\/strong>: \uace0\ucc28\uc6d0 \ub370\uc774\ud130\ub97c \uc800\ucc28\uc6d0\uc73c\ub85c \ucd95\uc18c\ud558\uc5ec \uc2dc\uac01\ud654, \ub178\uc774\uc988 \uac10\uc18c, \ub370\uc774\ud130 \uc555\ucd95 \ub4f1\uc5d0 \uc0ac\uc6a9.<\/li>\n\n\n\n<li><strong>\ub370\uc774\ud130 \uc804\ucc98\ub9ac<\/strong>: \ubcc0\uc218 \uac04\uc758 \uc0c1\uad00 \uad00\uacc4\ub97c \uc81c\uac70\ud558\uc5ec \ubd84\uc11d \ubc0f \ubaa8\ub378\ub9c1\uc758 \ud6a8\uc728\uc131\uc744 \ub192\uc785\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\uc774\ubbf8\uc9c0 \uc555\ucd95<\/strong>: \uc774\ubbf8\uc9c0 \ub370\uc774\ud130\uc758 \ucc28\uc6d0\uc744 \ucd95\uc18c\ud558\uc5ec \uc800\uc7a5 \uacf5\uac04\uc744 \uc904\uc774\uace0, \ucc98\ub9ac \uc18d\ub3c4\ub97c \ud5a5\uc0c1\uc2dc\ud0b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>LDA<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ubd84\ub958 \ubb38\uc81c<\/strong>: \ud074\ub798\uc2a4 \uac04\uc758 \ubd84\ub9ac\ub97c \ucd5c\ub300\ud654\ud558\uc5ec \ubd84\ub958 \ubaa8\ub378\uc758 \uc131\ub2a5\uc744 \ud5a5\uc0c1\uc2dc\ud0b5\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\ud2b9\uc9d5 \ucd94\ucd9c<\/strong>: \ud074\ub798\uc2a4 \uac04\uc758 \ucc28\uc774\ub97c \uac15\uc870\ud558\ub294 \ud2b9\uc9d5\uc744 \ucd94\ucd9c\ud558\uc5ec \ubd84\ub958 \ubaa8\ub378\uc758 \uc131\ub2a5\uc744 \ud5a5\uc0c1\uc2dc\ud0b5\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\uc5bc\uad74 \uc778\uc2dd<\/strong>: \uc5bc\uad74 \uc774\ubbf8\uc9c0\uc5d0\uc11c \uac01 \ud074\ub798\uc2a4(\uac1c\uc778)\ub97c \uad6c\ubd84\ud558\ub294 \ud2b9\uc9d5\uc744 \ucd94\ucd9c\ud558\ub294 \ub370 \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Python_%EC%98%88%EC%8B%9C_%EC%BD%94%EB%93%9C-2\"><\/span>Python \uc608\uc2dc \ucf54\ub4dc<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\uc544\ub798\ub294 PCA\uc640 LDA\ub97c \uac01\uac01 \uc218\ud589\ud558\ub294 \uac04\ub2e8\ud55c Python \uc608\uc2dc\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">PCA \uc608\uc2dc<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom sklearn.decomposition import PCA\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.datasets import load_iris\n\n# Iris \ub370\uc774\ud130\uc14b \ub85c\ub4dc\niris = load_iris()\nX = iris.data\ny = iris.target\ntarget_names = iris.target_names\n\n# \ub370\uc774\ud130 \ud45c\uc900\ud654\nscaler = StandardScaler()\nX_standardized = scaler.fit_transform(X)\n\n# PCA \ubaa8\ub378 \uc0dd\uc131 \ubc0f \ud559\uc2b5\npca = PCA(n_components=2)\nprincipal_components = pca.fit_transform(X_standardized)\n\n# \uc8fc\uc131\ubd84 \ub370\uc774\ud130\ud504\ub808\uc784 \uc0dd\uc131\ndf_pca = pd.DataFrame(data=principal_components, columns=&#091;'Principal Component 1', 'Principal Component 2'])\ndf_pca&#091;'Species'] = pd.Categorical.from_codes(y, target_names)\n\n# PCA \uacb0\uacfc \uc2dc\uac01\ud654\nplt.figure(figsize=(10, 6))\ncolors = &#091;'navy', 'turquoise', 'darkorange']\nlw = 2\n\nfor color, target_name in zip(colors, target_names):\n    plt.scatter(df_pca.loc&#091;df_pca&#091;'Species'] == target_name, 'Principal Component 1'],\n                df_pca.loc&#091;df_pca&#091;'Species'] == target_name, 'Principal Component 2'],\n                color=color, alpha=0.8, lw=lw,\n                label=target_name)\n\nplt.legend(loc='best', shadow=False, scatterpoints=1)\nplt.title('PCA of IRIS dataset')\nplt.xlabel('Principal Component 1')\nplt.ylabel('Principal Component 2')\nplt.grid(True)\nplt.show()\n\n# \uc124\uba85\ub41c \ubd84\uc0b0 \ube44\uc728 \ucd9c\ub825\nprint('Explained Variance Ratio:', pca.explained_variance_ratio_)<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">LDA \uc608\uc2dc<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.datasets import load_iris\n\n# Iris \ub370\uc774\ud130\uc14b \ub85c\ub4dc\niris = load_iris()\nX = iris.data\ny = iris.target\ntarget_names = iris.target_names\n\n# \ub370\uc774\ud130 \ud45c\uc900\ud654\nscaler = StandardScaler()\nX_standardized = scaler.fit_transform(X)\n\n# LDA \ubaa8\ub378 \uc0dd\uc131 \ubc0f \ud559\uc2b5\nlda = LDA(n_components=2)\nlda_components = lda.fit_transform(X_standardized, y)\n\n# \ud310\ubcc4 \uc131\ubd84 \ub370\uc774\ud130\ud504\ub808\uc784 \uc0dd\uc131\ndf_lda = pd.DataFrame(data=lda_components, columns=&#091;'LD1', 'LD2'])\ndf_lda&#091;'Species'] = pd.Categorical.from_codes(y, target_names)\n\n# LDA \uacb0\uacfc \uc2dc\uac01\ud654\nplt.figure(figsize=(10, 6))\ncolors = &#091;'navy', 'turquoise', 'darkorange']\nlw = 2\n\nfor color, target_name in zip(colors, target_names):\n    plt.scatter(df_lda.loc&#091;df_lda&#091;'Species'] == target_name, 'LD1'],\n                df_lda.loc&#091;df_lda&#091;'Species'] == target_name, 'LD2'],\n                color=color, alpha=0.8, lw=lw,\n                label=target_name)\n\nplt.legend(loc='best', shadow=False, scatterpoints=1)\nplt.title('LDA of IRIS dataset')\nplt.xlabel('Linear Discriminant 1')\nplt.ylabel('Linear Discriminant 2')\nplt.grid(True)\nplt.show()<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%EA%B2%B0%EA%B3%BC_%ED%95%B4%EC%84%9D-4\"><\/span>\uacb0\uacfc \ud574\uc11d<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>PCA \uacb0\uacfc<\/strong>: \uc8fc\uc131\ubd84 \uacf5\uac04\uc5d0\uc11c \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud654\ud558\ub294 \ubc29\ud5a5\uc73c\ub85c \ubcc0\ud658\ub41c \ub370\uc774\ud130 \ud3ec\uc778\ud2b8.<\/li>\n\n\n\n<li><strong>LDA \uacb0\uacfc<\/strong>: \ud074\ub798\uc2a4 \uac04\uc758 \ubd84\ub9ac\ub97c \ucd5c\ub300\ud654\ud558\ub294 \ubc29\ud5a5\uc73c\ub85c \ubcc0\ud658\ub41c \ub370\uc774\ud130 \ud3ec\uc778\ud2b8.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\uc774 \uc608\uc2dc\ub294 PCA\uc640 LDA\uac00 \uc5b4\ub5bb\uac8c \ub370\uc774\ud130\ub97c \ubcc0\ud658\ud558\ub294\uc9c0, \uadf8\ub9ac\uace0 \uacb0\uacfc\uac00 \uc5b4\ub5bb\uac8c \ub2e4\ub978\uc9c0\ub97c \ubcf4\uc5ec\uc90d\ub2c8\ub2e4. PCA\ub294 \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud654\ud558\ub294 \uc8fc\uc131\ubd84\uc744 \ucc3e\uace0, LDA\ub294 \ud074\ub798\uc2a4 \uac04\uc758 \ubd84\ub9ac\ub97c \ucd5c\ub300\ud654\ud558\ub294 \uc131\ubd84\uc744 \ucc3e\uc2b5\ub2c8\ub2e4. \uc774 \ucc28\uc774\ub294 \uac01 \ubc29\ubc95\uc774 \ub370\uc774\ud130 \ubd84\uc11d\uacfc \ubd84\ub958 \ubb38\uc81c\uc5d0\uc11c \uc5b4\ub5bb\uac8c \uc0ac\uc6a9\ub418\ub294\uc9c0\uc5d0 \uc601\ud5a5\uc744 \ubbf8\uce69\ub2c8\ub2e4.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"5\" src=\"http:\/\/www.ohsumin.com\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-23-1024x5.jpg\" alt=\"\" class=\"wp-image-1193\" srcset=\"http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-23-1024x5.jpg 1024w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-23-300x1.jpg 300w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-23-768x4.jpg 768w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-23-1536x7.jpg 1536w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-23-2048x10.jpg 2048w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-23-1320x6.jpg 1320w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-23-920x4.jpg 920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%EC%98%88%EC%8B%9C_IRIS_%EB%8D%B0%EC%9D%B4%ED%84%B0\"><\/span>\uc608\uc2dc : IRIS \ub370\uc774\ud130 <span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"456\" height=\"377\" src=\"http:\/\/www.ohsumin.com\/sm24_wp\/wp-content\/uploads\/2024\/07\/PCA-of-IRIS-dataset-1.png\" alt=\"\" class=\"wp-image-1196\" style=\"width:354px;height:auto\" srcset=\"http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/PCA-of-IRIS-dataset-1.png 456w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/PCA-of-IRIS-dataset-1-300x248.png 300w\" sizes=\"auto, (max-width: 456px) 100vw, 456px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"666\" src=\"http:\/\/www.ohsumin.com\/sm24_wp\/wp-content\/uploads\/2024\/07\/output-36-1024x666.png\" alt=\"\" class=\"wp-image-1197\" style=\"width:503px;height:auto\" srcset=\"http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/output-36-1024x666.png 1024w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/output-36-300x195.png 300w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/output-36-768x499.png 768w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/output-36-1536x999.png 1536w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/output-36-1320x858.png 1320w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/output-36-920x598.png 920w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/output-36.png 1693w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\uc704 \uadf8\ub9bc\uc740 \uc8fc\uc131\ubd84 \ubd84\uc11d(PCA)\uc744 \uc0ac\uc6a9\ud558\uc5ec Iris \ub370\uc774\ud130\uc14b\uc758 \uacb0\uacfc\ub97c \uc2dc\uac01\ud654\ud55c \uac83\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%EA%B5%AC%EC%84%B1_%EC%9A%94%EC%86%8C\"><\/span>\uad6c\uc131 \uc694\uc18c:<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\uc0b0\uc810\ub3c4 (Scatter Plot)<\/strong>:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uac01 \uc810\uc740 \ub370\uc774\ud130 \ud3ec\uc778\ud2b8\ub97c \ub098\ud0c0\ub0b4\uba70, \uc11c\ub85c \ub2e4\ub978 \uc0c9\uc0c1\uc740 \uc138 \uac00\uc9c0 \ud488\uc885(Setosa, Versicolor, Virginica)\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\uc8fc\uc131\ubd84 (Principal Components)<\/strong>:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>X\ucd95\uc740 \uccab \ubc88\uc9f8 \uc8fc\uc131\ubd84(Principal Component 1)\uc744, Y\ucd95\uc740 \ub450 \ubc88\uc9f8 \uc8fc\uc131\ubd84(Principal Component 2)\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4.<\/li>\n\n\n\n<li>\uc774 \ub450 \uc8fc\uc131\ubd84\uc740 \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud55c \ubcf4\uc874\ud558\uba74\uc11c, \ub370\uc774\ud130\uc758 \uc8fc\uc694 \ubcc0\ub3d9\uc131\uc744 \uc124\uba85\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">PCA \ubd84\uc11d \uadf8\ub9bc\uc744 \uadf8\ub9ac\uae30 \uc704\ud574 Iris \ub370\uc774\ud130\uc14b\uc744 \uc774\uc6a9\ud55c \uc608\uc81c\ub97c \uc900\ube44\ud588\uc2b5\ub2c8\ub2e4. \uc544\ub798 \ucf54\ub4dc\ub294 Iris \ub370\uc774\ud130\uc14b\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc8fc\uc131\ubd84 \ubd84\uc11d(PCA)\uc744 \uc218\ud589\ud55c \uacb0\uacfc\ub97c \uc2dc\uac01\ud654\ud558\ub294 \uacfc\uc815\uc744 \ubcf4\uc5ec\uc90d\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"PCA_%EB%B6%84%EC%84%9D_%EB%B0%8F_%EC%8B%9C%EA%B0%81%ED%99%94_%EC%BD%94%EB%93%9C\"><\/span>PCA \ubd84\uc11d \ubc0f \uc2dc\uac01\ud654 \ucf54\ub4dc<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom sklearn.decomposition import PCA\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.datasets import load_iris\n\n# Iris \ub370\uc774\ud130\uc14b \ub85c\ub4dc\niris = load_iris()\nX = iris.data\ny = iris.target\ntarget_names = iris.target_names\n\n# \ub370\uc774\ud130 \ud45c\uc900\ud654\nscaler = StandardScaler()\nX_standardized = scaler.fit_transform(X)\n\n# PCA \ubaa8\ub378 \uc0dd\uc131 \ubc0f \ud559\uc2b5\npca = PCA(n_components=2)\nprincipal_components = pca.fit_transform(X_standardized)\n\n# \uc8fc\uc131\ubd84 \ub370\uc774\ud130\ud504\ub808\uc784 \uc0dd\uc131\ndf_pca = pd.DataFrame(data=principal_components, columns=&#091;'Principal Component 1', 'Principal Component 2'])\ndf_pca&#091;'Species'] = pd.Categorical.from_codes(y, target_names)\n\n# PCA \uacb0\uacfc \uc2dc\uac01\ud654\nplt.figure(figsize=(12, 8))\ncolors = &#091;'navy', 'turquoise', 'darkorange']\nlw = 2\n\nfor color, target_name in zip(colors, target_names):\n    plt.scatter(df_pca.loc&#091;df_pca&#091;'Species'] == target_name, 'Principal Component 1'],\n                df_pca.loc&#091;df_pca&#091;'Species'] == target_name, 'Principal Component 2'],\n                color=color, alpha=0.8, lw=lw,\n                label=target_name)\n\nplt.legend(loc='best', shadow=False, scatterpoints=1)\nplt.title('PCA of IRIS dataset')\nplt.xlabel('Principal Component 1')\nplt.ylabel('Principal Component 2')\nplt.grid(True)\nplt.show()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc774 \ucf54\ub4dc\ub294 \ub2e4\uc74c\uacfc \uac19\uc740 \uc791\uc5c5\uc744 \uc218\ud589\ud569\ub2c8\ub2e4:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Iris \ub370\uc774\ud130\uc14b \ub85c\ub4dc<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>load_iris()<\/code> \ud568\uc218\ub97c \uc0ac\uc6a9\ud558\uc5ec Iris \ub370\uc774\ud130\uc14b\uc744 \ub85c\ub4dc\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\ub370\uc774\ud130 \ud45c\uc900\ud654<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>StandardScaler()<\/code>\ub97c \uc0ac\uc6a9\ud558\uc5ec \ub370\uc774\ud130\uc758 \uac01 \ud2b9\uc131\uc744 \ud3c9\uade0\uc774 0, \ud45c\uc900\ud3b8\ucc28\uac00 1\uc774 \ub418\ub3c4\ub85d \ud45c\uc900\ud654\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PCA \ubaa8\ub378 \uc0dd\uc131 \ubc0f \ud559\uc2b5<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>PCA(n_components=2)<\/code>\ub97c \uc0ac\uc6a9\ud558\uc5ec PCA \ubaa8\ub378\uc744 \uc0dd\uc131\ud558\uace0, \ub370\uc774\ud130\ub97c \ub450 \uac1c\uc758 \uc8fc\uc131\ubd84\uc73c\ub85c \ubcc0\ud658\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\uc8fc\uc131\ubd84 \ub370\uc774\ud130\ud504\ub808\uc784 \uc0dd\uc131<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ubcc0\ud658\ub41c \uc8fc\uc131\ubd84\uc744 \ub370\uc774\ud130\ud504\ub808\uc784\uc73c\ub85c \uc0dd\uc131\ud558\uace0, \uac01 \ub370\uc774\ud130 \ud3ec\uc778\ud2b8\uc758 \ud488\uc885\uc744 \ud3ec\ud568\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PCA \uacb0\uacfc \uc2dc\uac01\ud654<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uac01 \ud488\uc885(Setosa, Versicolor, Virginica)\uc744 \uc11c\ub85c \ub2e4\ub978 \uc0c9\uc0c1\uc73c\ub85c \uad6c\ubd84\ud558\uc5ec \uc0b0\uc810\ub3c4\ub85c \uc2dc\uac01\ud654\ud569\ub2c8\ub2e4.<\/li>\n\n\n\n<li>X\ucd95\uc740 \uccab \ubc88\uc9f8 \uc8fc\uc131\ubd84(Principal Component 1), Y\ucd95\uc740 \ub450 \ubc88\uc9f8 \uc8fc\uc131\ubd84(Principal Component 2)\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\uc774 \uadf8\ub9bc\uc744 \ud1b5\ud574 \ub370\uc774\ud130\uc758 \uc8fc\uc694 \ubcc0\ub3d9\uc131\uc744 \uc124\uba85\ud558\ub294 \uc8fc\uc131\ubd84\uc744 \uc2dc\uac01\uc801\uc73c\ub85c \ud655\uc778\ud560 \uc218 \uc788\uc73c\uba70, \uac01 \ud488\uc885 \uac04\uc758 \ubd84\ud3ec\ub97c \ube44\uad50\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%ED%95%B4%EC%84%9D\"><\/span>\ud574\uc11d:<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\ubd84\uc0b0 \uc124\uba85<\/strong>: \uccab \ubc88\uc9f8 \uc8fc\uc131\ubd84\uacfc \ub450 \ubc88\uc9f8 \uc8fc\uc131\ubd84\uc774 Iris \ub370\uc774\ud130\uc14b\uc758 \uc8fc\uc694 \ubcc0\ub3d9\uc131\uc744 \uc124\uba85\ud569\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\ud488\uc885 \uad6c\ubd84<\/strong>: \uc138 \uac00\uc9c0 \ud488\uc885\uc774 \uc8fc\uc131\ubd84 \uacf5\uac04\uc5d0\uc11c \uc5b4\ub5bb\uac8c \ubd84\ud3ec\ub418\uc5b4 \uc788\ub294\uc9c0\ub97c \uc2dc\uac01\uc801\uc73c\ub85c \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc608\ub97c \ub4e4\uc5b4, Setosa \ud488\uc885\uc740 \ub2e4\ub978 \ub450 \ud488\uc885\uacfc \uba85\ud655\ud558\uac8c \ubd84\ub9ac\ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\ub370\uc774\ud130 \ud328\ud134<\/strong>: \uc8fc\uc131\ubd84 \ubd84\uc11d\uc744 \ud1b5\ud574 \ub370\uc774\ud130\uc758 \uc8fc\uc694 \ud328\ud134\uc744 \ud30c\uc545\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\uc774 \uadf8\ub9bc\uc744 \ud1b5\ud574 PCA\uac00 \ub370\uc774\ud130\uc758 \ucc28\uc6d0\uc744 \uc904\uc774\uba74\uc11c \uc911\uc694\ud55c \ubcc0\ub3d9\uc131\uc744 \uc720\uc9c0\ud558\ub294 \ubc29\ubc95\uc744 \uc2dc\uac01\uc801\uc73c\ub85c \uc774\ud574\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc8fc\uc131\ubd84 \ubd84\uc11d\uc740 \ub370\uc774\ud130\uc758 \uad6c\uc870\ub97c \uc774\ud574\ud558\uace0, \ub370\uc774\ud130\uc758 \uc8fc\uc694 \ud2b9\uc131\uc744 \uac15\uc870\ud558\ub294 \ub370 \uc720\uc6a9\ud55c \ub3c4\uad6c\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"5\" src=\"http:\/\/www.ohsumin.com\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-24-1024x5.jpg\" alt=\"\" class=\"wp-image-1199\" srcset=\"http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-24-1024x5.jpg 1024w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-24-300x1.jpg 300w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-24-768x4.jpg 768w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-24-1536x7.jpg 1536w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-24-2048x10.jpg 2048w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-24-1320x6.jpg 1320w, http:\/\/www.inmining.co.kr\/sm24_wp\/wp-content\/uploads\/2024\/07\/line-24-920x4.jpg 920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%EC%98%88%EC%A0%9C_WINE_%EB%8D%B0%EC%9D%B4%ED%84%B0_%EB%B6%84%EC%84%9D\"><\/span>\uc608\uc81c  : WINE \ub370\uc774\ud130 \ubd84\uc11d<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\ub2e4\ub978 \ub370\uc774\ud130\uc14b\uc744 \uc0ac\uc6a9\ud558\uc5ec PCA\ub97c \uc218\ud589\ud574 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4. \uc5ec\uae30\uc11c\ub294 &#8220;Wine&#8221; \ub370\uc774\ud130\uc14b\uc744 \uc0ac\uc6a9\ud558\uc5ec PCA\ub97c \uc218\ud589\ud558\uace0 \uacb0\uacfc\ub97c \uc2dc\uac01\ud654\ud574\ubcf4\uaca0\uc2b5\ub2c8\ub2e4. &#8220;Wine&#8221; \ub370\uc774\ud130\uc14b\uc740 \uc640\uc778\uc758 \ud654\ud559\uc801 \ubd84\uc11d \uacb0\uacfc\ub85c, \uc138 \uac00\uc9c0 \ud488\uc885\uc758 \uc640\uc778\uc744 \uad6c\ubd84\ud558\ub294 13\uac1c\uc758 \ud654\ud559\uc801 \ud2b9\uc131\uc73c\ub85c \uad6c\uc131\ub429\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Wine_%EB%8D%B0%EC%9D%B4%ED%84%B0%EC%85%8B%EC%9D%84_%EC%82%AC%EC%9A%A9%ED%95%9C_PCA_%EB%B6%84%EC%84%9D_%EB%B0%8F_%EC%8B%9C%EA%B0%81%ED%99%94_%EC%BD%94%EB%93%9C\"><\/span>Wine \ub370\uc774\ud130\uc14b\uc744 \uc0ac\uc6a9\ud55c PCA \ubd84\uc11d \ubc0f \uc2dc\uac01\ud654 \ucf54\ub4dc<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom sklearn.decomposition import PCA\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.datasets import load_wine\n\n# Wine \ub370\uc774\ud130\uc14b \ub85c\ub4dc\nwine = load_wine()\nX = wine.data\ny = wine.target\ntarget_names = wine.target_names\n\n# \ub370\uc774\ud130 \ud45c\uc900\ud654\nscaler = StandardScaler()\nX_standardized = scaler.fit_transform(X)\n\n# PCA \ubaa8\ub378 \uc0dd\uc131 \ubc0f \ud559\uc2b5\npca = PCA(n_components=2)\nprincipal_components = pca.fit_transform(X_standardized)\n\n# \uc8fc\uc131\ubd84 \ub370\uc774\ud130\ud504\ub808\uc784 \uc0dd\uc131\ndf_pca = pd.DataFrame(data=principal_components, columns=&#091;'Principal Component 1', 'Principal Component 2'])\ndf_pca&#091;'Species'] = pd.Categorical.from_codes(y, target_names)\n\n# PCA \uacb0\uacfc \uc2dc\uac01\ud654\nplt.figure(figsize=(12, 8))\ncolors = &#091;'navy', 'turquoise', 'darkorange']\nlw = 2\n\nfor color, target_name in zip(colors, target_names):\n    plt.scatter(df_pca.loc&#091;df_pca&#091;'Species'] == target_name, 'Principal Component 1'],\n                df_pca.loc&#091;df_pca&#091;'Species'] == target_name, 'Principal Component 2'],\n                color=color, alpha=0.8, lw=lw,\n                label=target_name)\n\nplt.legend(loc='best', shadow=False, scatterpoints=1)\nplt.title('PCA of Wine dataset')\nplt.xlabel('Principal Component 1')\nplt.ylabel('Principal Component 2')\nplt.grid(True)\nplt.show()<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%EC%BD%94%EB%93%9C_%EC%84%A4%EB%AA%85\"><\/span>\ucf54\ub4dc \uc124\uba85<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Wine \ub370\uc774\ud130\uc14b \ub85c\ub4dc<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>load_wine()<\/code> \ud568\uc218\ub97c \uc0ac\uc6a9\ud558\uc5ec Wine \ub370\uc774\ud130\uc14b\uc744 \ub85c\ub4dc\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\ub370\uc774\ud130 \ud45c\uc900\ud654<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>StandardScaler()<\/code>\ub97c \uc0ac\uc6a9\ud558\uc5ec \ub370\uc774\ud130\uc758 \uac01 \ud2b9\uc131\uc744 \ud3c9\uade0\uc774 0, \ud45c\uc900\ud3b8\ucc28\uac00 1\uc774 \ub418\ub3c4\ub85d \ud45c\uc900\ud654\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PCA \ubaa8\ub378 \uc0dd\uc131 \ubc0f \ud559\uc2b5<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>PCA(n_components=2)<\/code>\ub97c \uc0ac\uc6a9\ud558\uc5ec PCA \ubaa8\ub378\uc744 \uc0dd\uc131\ud558\uace0, \ub370\uc774\ud130\ub97c \ub450 \uac1c\uc758 \uc8fc\uc131\ubd84\uc73c\ub85c \ubcc0\ud658\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\uc8fc\uc131\ubd84 \ub370\uc774\ud130\ud504\ub808\uc784 \uc0dd\uc131<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ubcc0\ud658\ub41c \uc8fc\uc131\ubd84\uc744 \ub370\uc774\ud130\ud504\ub808\uc784\uc73c\ub85c \uc0dd\uc131\ud558\uace0, \uac01 \ub370\uc774\ud130 \ud3ec\uc778\ud2b8\uc758 \ud488\uc885\uc744 \ud3ec\ud568\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PCA \uacb0\uacfc \uc2dc\uac01\ud654<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uac01 \ud488\uc885\uc744 \uc11c\ub85c \ub2e4\ub978 \uc0c9\uc0c1\uc73c\ub85c \uad6c\ubd84\ud558\uc5ec \uc0b0\uc810\ub3c4\ub85c \uc2dc\uac01\ud654\ud569\ub2c8\ub2e4.<\/li>\n\n\n\n<li>X\ucd95\uc740 \uccab \ubc88\uc9f8 \uc8fc\uc131\ubd84(Principal Component 1), Y\ucd95\uc740 \ub450 \ubc88\uc9f8 \uc8fc\uc131\ubd84(Principal Component 2)\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\uc774 \ucf54\ub4dc\ub97c \uc2e4\ud589\ud558\uba74 Wine \ub370\uc774\ud130\uc14b\uc5d0 \ub300\ud55c PCA \uacb0\uacfc\ub97c \uc2dc\uac01\ud654\ud55c \uadf8\ub9bc\uc774 \uc0dd\uc131\ub429\ub2c8\ub2e4. \uc774\ub97c \ud1b5\ud574 \ub370\uc774\ud130\uc758 \uc8fc\uc694 \ubcc0\ub3d9\uc131\uc744 \uc124\uba85\ud558\ub294 \uc8fc\uc131\ubd84\uc744 \uc2dc\uac01\uc801\uc73c\ub85c \ud655\uc778\ud560 \uc218 \uc788\uc73c\uba70, \uac01 \ud488\uc885 \uac04\uc758 \ubd84\ud3ec\ub97c \ube44\uad50\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc8fc\uc131\ubd84 \ubd84\uc11d(PCA, Principal Component Analysis)\uc740 \uace0\ucc28\uc6d0 \ub370\uc774\ud130\ub97c \uc800\ucc28\uc6d0\uc73c\ub85c \ucd95\uc18c\ud558\ub294 \ub370 \uc0ac\uc6a9\ub418\ub294 \uae30\ubc95\uc785\ub2c8\ub2e4. \uc774 \ubc29\ubc95\uc740 \ub370\uc774\ud130\uc758 \ubd84\uc0b0\uc744 \ucd5c\ub300\ud654\ud558\ub294 \uc0c8\ub85c\uc6b4&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1202,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1184","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-stat","wpcat-6-id"],"_links":{"self":[{"href":"http:\/\/www.inmining.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/1184","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.inmining.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.inmining.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.inmining.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.inmining.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1184"}],"version-history":[{"count":6,"href":"http:\/\/www.inmining.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/1184\/revisions"}],"predecessor-version":[{"id":1201,"href":"http:\/\/www.inmining.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/1184\/revisions\/1201"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.inmining.co.kr\/index.php?rest_route=\/wp\/v2\/media\/1202"}],"wp:attachment":[{"href":"http:\/\/www.inmining.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.inmining.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1184"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.inmining.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}