From 2b8d1336d7256eacff38ebc3ea03073347152ac0 Mon Sep 17 00:00:00 2001 From: Vladimir Protsenko Date: Mon, 6 Sep 2021 19:30:02 +0000 Subject: [PATCH] Update lab2.md --- lab2.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lab2.md b/lab2.md index fad73e1..645815e 100644 --- a/lab2.md +++ b/lab2.md @@ -206,18 +206,21 @@ from sklearn.metrics.pairwise import cosine_similarity dist = 1 - cosine_similarity(tfidf_matrix) dist.shape - # Метод главных компонент - PCA + +# Метод главных компонент - PCA from sklearn.decomposition import IncrementalPCA icpa = IncrementalPCA(n_components=2, batch_size=16) icpa.fit(dist) demo2 = icpa.transform(dist) xs, ys = demo2[:, 0], demo2[:, 1] + # PCA 3D from sklearn.decomposition import IncrementalPCA icpa = IncrementalPCA(n_components=3,batch_size=16) icpa.fit(dist) ddd = icpa.transform(dist) xs, ys, zs = ddd[:, 0], ddd[:, 1], ddd[:, 2] + #Можно сразу примерно посмотреть, что получится в итоге from mpl_toolkits.mplot3d import Axes3D fig = plt.figure()