Clustering
: ๋น์ทํ object๋ค ๋ผ๋ฆฌ ๋ชจ์ผ๋ ๊ฒ
ํน์ง
- Label data๊ฐ ์์ (๋ถ๋ฅ์์ ์ฐจ์ด์ )
- Unsupervised ML
์ ์ฉ ์ฌ๋ก
- ๊ณ ๊ฐ์ ๊ตฌ๋งค ํํ๋ณ ๋ถ๋ฅ
- ๊ณ ๊ฐ์ ์ทจํฅ์ ๋ง๋ ์ฑ , ๋์์ ๋ฑ์ ์ถ์ฒ
- ์ ์ฉ์นด๋ ์ฌ์ฉ์ fraud detection
- ๋ด์ค ์๋ ๋ถ๋ฅ ๋ฐ ์ถ์ฒ
- ์ ์ ์ ๋ถ์ ๋ฑ
์ข ๋ฅ
- K-Means Clustering
- Hierarchical Clustering (dendrogram)
- Density-based Clustering (DBSCAN)
K-Means Clustering ์๊ณ ๋ฆฌ์ฆ
[ Distance ๊ณ์ฐ ]
- Distance = Euclidean Distance (์ ํด๋ฆฌ๋ ๊ธฐํํ ๊ฑฐ๋ฆฌ)
- ๊ณต์ : $\sqrt{\sum^{n}{i=0} (x{1i} - x_{2i} )^2 }$
- ์์
Distance(x1, x2) = $\sqrt{(54 − 50)^2 + (190 − 200)^ 2 + (3 − 8)^ 2}$๊ณ ๊ฐ ๋์ด ์์ ๊ต์ก 1 → x1 54 190 3 2 → x2 50 200 8
⇒ ๋ ์ ์ฌ์ด์ ๊ฑฐ๋ฆฌ ์
[ ์๊ณ ๋ฆฌ์ฆ ๊ณผ์ ]
- Random ํ๊ฒ k ๊ฐ์ centroid (์ค์ฌ์ ) ๋ฅผ ์ ํ๋ค.
- ๊ฐ centroid ๋ก ๋ถํฐ ๊ฐ data point ๊น์ง์ ๊ฑฐ๋ฆฌ๋ฅผ ๊ณ์ฐ.
- ๊ฐ data point ๋ฅผ ๊ฐ์ฅ ๊ฐ๊น์ด centroid๋ก ํ ๋น
- ๊ฐ ํด๋ฌ์คํฐ์ centroid ์ ์์น๋ฅผ ๋ค์ ๊ณ์ฐ : ํด๋ฌ์คํฐ๋ณ๋ก, ๋ฐ์ดํฐ ํฌ์ธํธ๋ค์ ํ๊ท ์ ๊ณ์ฐํด ๊ทธ ์ ์ผ๋ก centroid๋ฅผ ์ฎ๊น
- ⇒ ํด๋ฌ์คํฐ ๋ณ๋ก ์ํ๋ ์ ๋ค์ด ๊ณ์ ๋ฐ๋
- centroid ๊ฐ ๋ ์ด์ ์์ง์ด์ง ์์ ๋๊น์ง 2-4 ๋จ๊ณ๋ฅผ ๋ฐ๋ณต
[ K ์ ํ๊ธฐ ]
- ๋ฐฉ๋ฒ : ๊ฒฝํ์ ์ผ๋ก $k=\sqrt{n} \ \ (n : data \ sample \ ๊ฐ์)$
(๊ฐ ํด๋ฌ์คํฐ์ centroid์์ ๋ฐ์ดํฐ ํฌ์ธํธ๋ค์ ํ๊ท ๊ฑฐ๋ฆฌ๊ฐ ์ด๋ ์๊ฐ์ด ๋๋ฉด ๊ธ๊ฒฉํ ์ค๋ค๊ฐ ์๋งํ ๊ฐ์ํ๋ ํํ๋ก ๋ณํ ๋์ ์ )
⇒ elbow point์ k๊ฐ์ ์ฌ์ฉ - ํน์ง
- K ๋ฅผ ์ ์ ํ๋ ๊ฒ์ด ์ค์ํ๋ค
- ํผ์ฒ๊ฐ ๋ง์ ์๋ก ๊ณ์ฐ๋ ์ฆ๊ฐ
- K๋ฅผ ๋ง์ด ์ค์๋ก, ๊ฐ ํด๋ฌ์คํฐ์ centroid์์์ ๋ฐ์ดํฐ ํฌ์ธํธ๋ค์ ํ๊ท ๊ฑฐ๋ฆฌ๊ฐ ๊ฐ์
[ ํน์ง ]
- ๋จ์ 1: ์์๋ก cluster ์ง์ ํ๋ฏ๋ก same cluster ๋ด์ data point ๋ค์ด ์ค์ ๋ก๋ ์ ์ฌํ์ง ์์ ์ ์๋ค
- ๋จ์ 2: ์ด์์น ๊ฐ์ง ๋ถ๊ฐ : ๊ฐ์ฅ ๊ฐ๊น์ด centroid๋ก ์ง์ด ๋ฃ์ผ๋ฏ๋ก, ์ด์์น๋ ์ด๋๊ฐ์ ํด๋ฌ์คํฐ์ ์ํ๊ฒ๋๋ค
- Spherical-shape clusters : ๊ตฌํ์ผ๋ก๋ shape์ ํด๋ฌ์คํฐ
DBSCAN (Density-Based Spatial Clustering of Applications with Noise)
- ํน์ง
- ๋ฐ๋๊ฐ ๋์ ์ง์ญ๊ณผ ๋ฎ์ ์ง์ญ์ ์๋ก ๋ถ๋ฆฌํ์ฌ ์ค์ ๋ฐ์ดํฐ ํฌ์ธํธ ๋ค์ด ์ ์ฌ (๋ฐ๋ – ํน์ ๋ฐ๊ฒฝ๋ด์ data point ์ซ์)
- ์ด์์น ๊ฐ์ง ๊ฐ๋ฅ : ๋ฐ๋ ๊ธฐ์ค์ผ๋ก ํ๊ธฐ ๋๋ฌธ์ ์ํ ๊ณณ์ด ์์ด, ์ด์์น ๊ฐ์ง ๊ฐ๋ฅ
⇒ a, b๋ kmeans์ ๋จ์ ํด๊ฒฐ - Outlier ์ ์ํฅ์ ์ ๊ฒ ๋ฐ์
- cluster ์ซ์๋ฅผ ๋ฏธ๋ฆฌ ์ ํด์ฃผ์ง ์์๋ ๋จ
- Arbitrary-shape clusters
- ์คํ ๊ณผ์
- Radius(๋ฐ๊ฒฝ) , Minimum Neighbor number ์ง์
- ๊ฐ point ๋ฅผ Core, Border, Outlier ๋ก ๊ตฌ๋ถ
- core : ํ ์ ์ Radius๋ฅผ ๊ธฐ์ค์ผ๋ก Minimum Neighbor number๊ฐ์ ์ด์์ ๋ฐ์ดํฐ์ ์ด ์์๊ฒฝ์ฐ ํด๋น ์ ์ core๋ผ๊ณ ํจ
- Border : Minimum Neighbor number ๊ฐ์ ๋ฏธ๋ง์ ๋ฐ์ดํฐ ์ ์ด ์์ ๊ฒฝ์ฐ
- Outlier : radius ์์ ์ด์ํ๋ ์ ์ด ์๋ ๊ฒฝ
- ๋ชจ๋ point ์ ๋ํด ๋์ผํ ๊ณผ์ ๋ฐ๋ณต
๊ตฐ์งํ ์ค์ต
KMeans
ํ๋ผ๋ฏธํฐ
- init : initialization method -> k-means++ (smart choosing of centroids)
- n_clusters : k ๊ฐ
- n_init : ๋ฐ๋ณตํ์
ํ ์ด ๋ฐ์ดํฐ ์์ฑ
# seed = 101๋ก ํด์ ์ด๋ค ์๊ณ ๋ฆฌ์ฆ์ ๋ฐ๋ผ ๋์๋ฅผ ์์ฑ -> ํญ์ ๊ฐ์ ๋ฐ์ดํฐ๋ฅผ ์์ฑ๊ฐ๋ฅ
np.random.seed(101)
# 3๊ฐ์ centroid ์ ์ ์ค : center ํฌ์ง์
์ ๋๊ฒ ๋ฒ๋ฆฌ๊ธฐ ์ํ ์์์ ์
centroidLocation = [[3,2], [1,-1],[-1,2]]
# ๋น์ง๋ ํ์ต์ ์ํด y ์๋ฆฌ๋ _ ๋ฅผ ์ฌ์ฉํด, ์์น๋ง ์ก์
X, _ = make_blobs(n_samples=1500, centers=centroidLocation)
# ๋ฐ์ดํฐ ๋ถํฌ ์๊ฐํ
plt.scatter(X[:,0], X[:,1], marker='.')
# ๋ฐ์ดํฐ shape
X.shape # (1500, 2)
Kmeans ์คํ
from sklearn.cluster import KMeans
# ๋ชจ๋ธ ๊ตฌ์ฑ
nclusters = 3
k_means = KMeans(n_clusters=nclusters)
# ํ์ต
k_means.fit(X)
# ๋ ์ด๋ธ : 0,1,2 ์ค ์ด๋๊ฑธ๋ก ์ํ๋์ง
k_means.labels_
# 3๊ฐ์ ์ํ ์์น : [3,2], [1,-1],[-1,2] => [1.04677914, -0.97038147], [3.14135743, 2.01895659], [-0.97958037, 2.04290344]
centers = k_means.cluster_centers_
ํด๋ฌ์คํฐ๋ง ๋ ๊ฒฐ๊ณผ ์๊ฐํ
from matplotlib.colors import ListedColormap
colors_bold = ListedColormap(['#FF0000', '#00FF00', '#0000FF'])
colors_light = ListedColormap(['#FFAAAA', '#AAFFAA', '#AAAAFF'])
plt.figure(figsize=(8,6))
for i in range(nclusters):
members = k_means.labels_ == i
plt.plot(X[members, 0], X[members, 1], '.',
color=colors_light(i), markersize=10, label=i)
plt.plot(centers[i, 0], centers[i, 1], 'o',
color=colors_bold(i), markeredgecolor='k', markersize=20)
plt.title("KMeans")
plt.legend()
DBSCAN
ํ๋ผ๋ฏธํฐ
- eps : epsilon (radius)
- min_sample : minimum samples within the radius
๋ฐ์ดํฐ ์์ฑ
# ์ด์์น๊ฐ ์๋ ๋ฐ์ดํฐ ํฌ์ธํธ ์์ฑ
X1, _ = make_blobs(n_samples=500, centers=[[-3,-3]])
X2, _ = make_blobs(n_samples=500, centers=[[3,3]])
X3 = np.random.rand(500, 2) * 3 + 4
X4 = np.random.randn(10, 2) * 3 #outlier
X1.shape, X2.shape, X3.shape, X4.shape # ((500, 2), (500, 2), (500, 2), (10, 2))
# ๋ฐ์ดํฐ ๋ถํฌ ์๊ฐํ
plt.figure(figsize=(8, 6))
plt.scatter(X1[:, 0], X1[:, 1], marker='.')
plt.scatter(X2[:, 0], X2[:, 1], marker='.')
plt.scatter(X3[:, 0], X3[:, 1], marker='.')
plt.scatter(X4[:, 0], X4[:, 1], marker='.')
# 4๊ฐ์ ๋ฐ์ดํฐ๋ฅผ ํ๋๋ก ํฉ์นจ
X = np.vstack([X1, X2, X3, X4])
X.shape # (1510, 2)
# ํฉ์น ๋ฐ์ดํฐ ์๊ฐํ
plt.figure(figsize=(8, 6))
plt.scatter(X[:, 0], X[:, 1], marker='.')
DBSCAN ๋ชจ๋ธ๋ง
from sklearn.cluster import DBSCAN
# ๋ชจ๋ธ๋ง
epsilon = 0.3 # ๋ฐ๊ฒฝ radius
minimumSamples = 7
db = DBSCAN(eps=epsilon, min_samples=minimumSamples).fit(X)
# ๋ ์ด๋ธ ํ์ธ
labels = db.labels_ # [ 0 0 -1 ... 4 -1 -1]
unique_labels = set(labels) # {-1, 0, 1, 2, 3, 4, 5} -1 : outlier
print(labels.shape) # (1510, )
print(db.core_sample_indices_.shape) # (1234, )
print(db.core_sample_indices_) # [ 0 1 3 ... 1499 1505 1507]
DBSCAN ์๊ฐํ
colors = plt.cm.Spectral(np.linspace(0, 1, len(unique_labels)))
plt.figure(figsize=(8, 6))
for k, col in zip(unique_labels, colors):
members = (labels == k)
plt.scatter(X[members, 0], X[members, 1], color=col,
marker='o', s=10)
plt.title('DBSCAN')
plt.show()
์ฐจ์ ์ถ์ ๊ธฐ๋ฒ : PCA
์ฐจ์์ ์ ์ฃผ (Curse of Dimensionality)
: ์ฐจ์์ด ์ฆ๊ฐํจ์ ๋ฐ๋ผ vector ๊ณต๊ฐ๋ด์ space ๋ ์ฆ๊ฐํ๋๋ฐ ๋ฐ์ดํฐ์ ์์ด ์ ์ผ๋ฉด ๋น๊ณต๊ฐ์ด ๋ง์ด ๋ฐ์ํ์ฌ ์์ธก์ ์ ํ๋๊ฐ ๋จ์ด์ง๋ค.
(⇒ ํผ์ฒ๊ฐ ์ฆ๊ฐํ๋ฉด ์ถ์ด ๋์ด๋๋ฏ๋ก, ์ฐจ์์ด ์ฆ๊ฐํ๋ค. ๊ทธ๋ฌ๋ฏ๋ก ํผ์ฒ๊ฐ ๋์ด๋ ์๋ก ๋ฐ์ดํฐ์ ์์ด ๋์ด๋์ผํ๋ค.)
- ํด๊ฒฐ๋ฐฉ๋ฒ : ์ ์ฌํ ์ฑ๊ฒฉ์ feature๋ ํ๋์ ์๋ก์ด feature๋ก ์ฑ๋ถ์ ํฉ์น ์ ์์ (์, ํค, ์ ์ฅ, ์์ํค ⇒ ํค)
- ์ฐจ์ ์ถ์์, ์ ๋ณด ์์ค ๋ฐ์
⇒ PC(principal component) : X, Y์ถ์ ์ ๋ณด๋ฅผ ์ด๋์ ๋ ๋ณด์กดํ๋ ์๋ก์ด ์
PCA (Principal Component Analysis) : ์ฃผ์ฑ๋ถ ๋ถ์
1. ๋ฐฉ๋ฒ : ์ ํ๋์ํ์ SVD (ํน์ด๊ฐ ๋ถํด) ๋ฅผ ์ด์ฉํ์ฌ ๋ถ์ฐ์ด ์ต๋์ธ ์ถ์ ์ฐพ์
- ๋ฐ์ดํฐ์ ๋ถ์ฐ์ ์ต๋ํ ๋ณด์กดํ๋ฉด์ ์๋ก ์ง๊ตํ๋ ์ ์ถ์ ์ฐพ์
⇒ ๋ฐ์ดํฐ๊ฐ ํผ์ ธ์๋ ์ ๋๊ฐ ๊ฐ์ฅ ์ ๋ณด์กด๋๋ ์ ์ ์ฐพ๋ ๊ฒ
(๋ถ์ฐ์ ๋ณด์กดํ๋ค == ์ต๋ํ ์๋์ ์ ๋ณด๋ฅผ ๋ณด์กดํ๋ค) - ๊ณ ์ฐจ์ ๊ณต๊ฐ์ ํ๋ณธ๋ค์ ์ ํ ์ฐ๊ด์ฑ์ด ์๋ ์ ์ฐจ์ ๊ณต๊ฐ์ผ๋ก ๋ณํ
PCA ํ๋ผ๋ฏธํฐ
- components_
- array, shape (n_components, n_features)
- n_feature dimension ๊ณต๊ฐ์์์ ์ฃผ์ฑ๋ถ ์ถ
- data ์ ๋ถ์ฐ์ ์ต๋๋ก ๋ณด์กดํ๋ ๋ฐฉํฅ
- explained_variance_ ์ ์์๋๋ก ์ ๋ ฌ๋์ด ์์
- explained_variance_
- shape (n_components,)
- ์ ํํ ๊ฐ ๊ตฌ์ฑ ์์์์ ์ค๋ช ํ๋ ๋ถ์ฐ์ ์
- explained_variance_ratio_
- shape (n_components,)
- ์ ํํ ๊ฐ ๊ตฌ์ฑ ์์๊ฐ ์ค๋ช
ํ๋ ๋ถ์ฐ์ ๋ฐฑ๋ถ์จ์
๋๋ค.
PCA ์ค์ต
# ๊ฐ ํ์ ๊ณ ๊ฐ์ ๋ํ๋ด๊ณ ๊ฐ ์ด์ ๊ณ ๊ฐ์ ์์ฑ ํ์
# ์ง๋๋ฌ์ ํํํ ๊ณ ๊ฐ์ ๋ํ ์ ๋ณด๊ฐ ํฌํจ (Churn 1.0 - ํํ, 0.0 - ์ ์ง)
# 28๊ฐ์ ํผ์ฒ๋ฅผ ์ฐจ์ ์ถ์ํ์ฌ ํด๋น ๊ณ ๊ฐ์ด ํํํ ๊ฒ์ธ์ง๋ฅผ ์์ธก
# 2์ฐจ์ ์์ ์๊ฐํํ ์ ์๊ธฐ ๋๋ฌธ์ pca๋ฅผ ํตํด 2์ฐจ์์ผ๋ก ์ถ์ํ๋ ๊ฒ
churn_df = pd.read_csv("datasets/ChurnData.csv")
# ๋ฐ์ดํฐ ํ์ธ
churn_df.head()
# ์นผ๋ผ ํ์ธ
churn_df.columns
# Index(['tenure', 'age', 'address', 'income', 'ed', 'employ', 'equip',
'callcard', 'wireless', 'longmon', 'tollmon', 'equipmon', 'cardmon',
'wiremon', 'longten', 'tollten', 'cardten', 'voice', 'pager',
'internet', 'callwait', 'confer', 'ebill', 'loglong', 'logtoll',
'lninc', 'custcat', 'churn'],
dtype='object')
# churn : ์์ธกํ ํผ์ฒ
# shape ํ์ธ
churn_df.shape # (200,28)
X = churn_df.loc[:, columns]
y = churn_df['churn']
tenure age address income ed employ equip callcard wireless longmon ... pager internet callwait confer ebill loglong logtoll lninc custcat churn
| tenure | age | address | income | ed | employ | equip | loglong | logtoll | lninc | custcat | churn | ||
| 0 | 11.0 | 33.0 | 7.0 | 136.0 | 5.0 | 5.0 | 0.0 | ... | 1.482 | 3.033 | 4.913 | 4.0 | 1.0 |
| 1 | 33.0 | 33.0 | 12.0 | 33.0 | 2.0 | 0.0 | 0.0 | ... | 2.246 | 3.240 | 3.497 | 1.0 | 1.0 |
| 2 | 23.0 | 30.0 | 9.0 | 30.0 | 1.0 | 2.0 | 0.0 | ... | 1.841 | 3.240 | 3.401 | 3.0 | 0.0 |
| 3 | 38.0 | 35.0 | 5.0 | 76.0 | 2.0 | 10.0 | 1.0 | ... | 1.800 | 3.807 | 4.331 | 4.0 | 0.0 |
| 4 | 7.0 | 35.0 | 14.0 | 80.0 | 2.0 | 15.0 | 0.0 | ... | 1.960 | 3.091 | 4.382 | 3.0 | 0.0 |
๋ฐ์ดํฐ ๋ถ๋ฆฌ
# train / test dataset split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
# ์ต์ข
๋ฐ์ดํฐ shape ํ์ธ
print(X_train.shape) # (160, 27)
print(X_test.shape) # (40, 27)
# ์ค์ผ์ผ๋ง
sc = StandardScaler()
X_train = sc.fit_transform(X_train)
X_test = sc.transform(X_test)
PCA ์ ์ฉ ์ , logistic regression ๊ฒฐ๊ณผ : ํํ ์ฌ๋ถ ์์ธก
# Fitting Logistic Regression
clf = LogisticRegression(solver='lbfgs', random_state=0)
clf.fit(X_train, y_train)
# predict test set
y_pred = clf.predict(X_test)
# Confusion matrix
accuracy_score(y_test, y_pred) # 0.775
PCA ์ ์ฉ ํ, logistic regression ๊ฒฐ๊ณผ : ํํ ์ฌ๋ถ ์์ธก
PCA ์ ์ฉ : ํผ์ฒ ๊ฐ์ 27 -> 2
# Apply kernel PCA
from sklearn.decomposition import PCA
pca = PCA(n_components=2) # 2๊ฐ component๋ก ์ฐจ์ ์ถ์
X_train_pca = pca.fit_transform(X_train) # pca ํจ์๊ฐ ๋ค์ฐจ์ ๊ณต๊ฐ์ ๊ณต๋ถ์ฐ(๋ถ์ฐ์ด ์ต๋ํ ๋๋ ์ถ)์ ์ฐพ์ -> ๋๊ฐ์ ๋งคํธ๋ฆญ์ค๋ก๋ ฅ
X_test_pca = pca.transform(X_test) # ๋์ผํ ๋ถํฌ๋ฅผ ๊ฐ์ง๊ฒ์ผ๋ก ํด์ผํ๋ฏ๋ก fit_transform ์ด ์๋ transform๋ง
print("์ฐจ์ ์ถ์๋ X_train :", X_train_pca.shape) # (160, 2)
print("์ฐจ์ ์ถ์๋ X_test :", X_test_pca.shape) # (40, 2)
print(pca.components_.shape) # (2,27)
print("์ฒซ๋ฒ์งธ ์ฃผ์ฑ๋ถ(๊ณ ์ ๋ฒกํฐ) :")
print(pca.components_[0])
์ฒซ๋ฒ์งธ ์ฃผ์ฑ๋ถ(๊ณ ์ ๋ฒกํฐ) :
[0.18870382 0.09407626 0.06999421 0.02405283 0.08039882 0.10532452
0.0913006 0.22012759 0.24022929 0.17035807 0.26783154 0.16389682
0.25017627 0.28326203 0.17638143 0.27435707 0.22993114 0.24062665
0.26112415 0.0747603 0.22729268 0.21587761 0.06959358 0.17457864
0.17900112 0.07082588 0.29324012]
print("๋๋ฒ์งธ ์ฃผ์ฑ๋ถ(๊ณ ์ ๋ฒกํฐ) :")
print(pca.components_[1])
๋๋ฒ์งธ ์ฃผ์ฑ๋ถ(๊ณ ์ ๋ฒกํฐ) :
[ 0.2917276 0.18411246 0.24507417 0.04409899 -0.16349343 0.2142686
-0.23252316 0.07599265 -0.23520159 0.29224485 -0.06742566 -0.24108039
0.12944092 -0.20861384 0.29806582 0.04425842 0.22376079 -0.18866967
-0.17737835 -0.24830636 -0.0674659 -0.05215805 -0.21541163 0.28738933
0.03136523 0.07488121 -0.10196478]
print('์ค๋ช
๋ ๋ถ์ฐ(๊ณ ์ ๊ฐ)์ ๋น์จ: {}, ๋ ์ฑ๋ถ์ ํฉ: {:.2f}'
.format(pca.explained_variance_ratio_,sum(pca.explained_variance_ratio_)))
์ค๋ช
๋ ๋ถ์ฐ(๊ณ ์ ๊ฐ)์ ๋น์จ: [0.25193472 0.21764464], ๋ ์ฑ๋ถ์ ํฉ: 0.47
Logistic regression ์ ์ฉ
# Fitting Logistic Regression
clf = LogisticRegression(solver='lbfgs', random_state=0)
clf.fit(X_train_pca, y_train)
# predict test set
y_pred = clf.predict(X_test_pca)
y_pred # array([0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 1., 1., 0., 1., 1., 0., 0., 0., 0., 0., 0., 0., 0.])
# Accuracy Score
from sklearn.metrics import accuracy_score
accuracy_score(y_test, y_pred) # 0.725 -> ์ฐจ์ ์ถ์ ํ์๋ ๋ณ ์ฐจ์ด๊ฐ ์์ : ์ ๋ณด ์์ค์ด ๊ฑฐ์ ์
์๊ฐํ : ์ฐจ์์ถ์๋ churn data
→ 2๊ฐ๋ก ์ถ์๋์๊ธฐ ๋๋ฌธ์ ํ๋ฉด์์ ์๊ฐํ ๊ฐ๋ฅ
→ X_train_pca ⇒ X1, X2 ์ถ์ผ๋ก ์๊ฐํ
→ y_train : 0,1์ ์์ผ๋ก ๊ตฌ๋ถ (0 : ํํ X, 1 : ํํ O)
