質問編集履歴
1
features?pcaの実行したデータを追加しました。結果としてはエラーの解消によるPCAの正しい実行データを得たいと思っています。説明不足で申し訳ございません。
title
CHANGED
File without changes
|
body
CHANGED
@@ -29,6 +29,14 @@
|
|
29
29
|
pca = PCA(n_components=0.99,whiten=True)
|
30
30
|
#PCAの実行
|
31
31
|
features_pca = pca.fit_transform(features)
|
32
|
-
#
|
32
|
+
#結果の表示
|
33
|
+
print("もとの特徴量数:", features.shape[1])
|
34
|
+
print("削除後の特徴量数:", features_pca.shape[1])
|
35
|
+
もとの特徴量数: 100
|
36
|
+
削除後の特徴量数: 1
|
37
|
+
|
38
|
+
#feature_pca
|
39
|
+
array([[0.]])
|
40
|
+
#エラー内容(PCA実行時に出てくるエラー文)
|
33
41
|
RuntimeWarning: invalid value encountered in true_divide
|
34
42
|
explained_variance_ = (S ** 2) / (n_samples - 1)
|