回答編集履歴

2

edit

2018/05/09 22:43

投稿

mkgrei
mkgrei

スコア8560

test CHANGED
@@ -28,6 +28,28 @@
28
28
 
29
29
 
30
30
 
31
+ ```
32
+
33
+ PC 1 without scaling:
34
+
35
+ [ 1.76e-03 -8.36e-04 1.55e-04 -5.31e-03 2.02e-02 1.02e-03
36
+
37
+ 1.53e-03 -1.12e-04 6.31e-04 2.33e-03 1.54e-04 7.43e-04
38
+
39
+ 1.00e+00(13番目の成分)]
40
+
41
+
42
+
43
+ PC 1 with scaling:
44
+
45
+ [ 0.13 -0.26 -0.01 -0.23 0.16 0.39 0.42 -0.28 0.33 -0.11 0.3 0.38
46
+
47
+ 0.28(13番目の成分)]
48
+
49
+ ```
50
+
51
+
52
+
31
53
  データの標準化は重要な前処理である。
32
54
 
33
55
  多くのアルゴリズムでは特徴量(Xのこと)が正規化されていることが要求されるが、直感的にはPCAがその最たる例である。

1

edit

2018/05/09 22:43

投稿

mkgrei
mkgrei

スコア8560

test CHANGED
@@ -1 +1,43 @@
1
1
  http://scikit-learn.org/stable/auto_examples/preprocessing/plot_scaling_importance.html
2
+
3
+
4
+
5
+ ---
6
+
7
+
8
+
9
+ コード付きなので、実行してみると感覚をつかめるかと思います。
10
+
11
+ 前処理などの性能を比較する際によくやるようなものになっています。
12
+
13
+
14
+
15
+ 略訳
16
+
17
+
18
+
19
+ > Feature scaling though standardization (or Z-score normalization) can be an important preprocessing step for many machine learning algorithms. Standardization involves rescaling the features such that they have the properties of a standard normal distribution with a mean of zero and a standard deviation of one.
20
+
21
+ While many algorithms (such as SVM, K-nearest neighbors, and logistic regression) require features to be normalized, intuitively we can think of Principle Component Analysis (PCA) as being a prime example of when normalization is important. In PCA we are interested in the components that maximize the variance. If one component (e.g. human height) varies less than another (e.g. weight) because of their respective scales (meters vs. kilos), PCA might determine that the direction of maximal variance more closely corresponds with the ‘weight’ axis, if those features are not scaled. As a change in height of one meter can be considered much more important than the change in weight of one kilogram, this is clearly incorrect.
22
+
23
+ To illustrate this, PCA is performed comparing the use of data with StandardScaler applied, to unscaled data. The results are visualized and a clear difference noted. The 1st principal component in the unscaled set can be seen. It can be seen that feature #13 dominates the direction, being a whole two orders of magnitude above the other features. This is contrasted when observing the principal component for the scaled version of the data. In the scaled version, the orders of magnitude are roughly the same across all the features.
24
+
25
+ The dataset used is the Wine Dataset available at UCI. This dataset has continuous features that are heterogeneous in scale due to differing properties that they measure (i.e alcohol content, and malic acid).
26
+
27
+ The transformed data is then used to train a naive Bayes classifier, and a clear difference in prediction accuracies is observed wherein the dataset which is scaled before PCA vastly outperforms the unscaled version.
28
+
29
+
30
+
31
+ データの標準化は重要な前処理である。
32
+
33
+ 多くのアルゴリズムでは特徴量(Xのこと)が正規化されていることが要求されるが、直感的にはPCAがその最たる例である。
34
+
35
+ PCAでは分散を最大化するように成分を抽出する。
36
+
37
+ もし1つの成分の分散が他のものより大きいのが、その成分のスケールのせいである時、PCAはその成分の支配度を大きく見積もってしまい、これは明らかに誤りである。(例と対応させるため、小さい→大きい、に変更)
38
+
39
+ 以上を示すためにPCAの前に標準化を行うか否かで比較を行う。
40
+
41
+ 標準化を行わないと13番目の成分が大きな割合を占めるのに対して、標準化を行うことで全ての成分が同じ程度の割合で取り入れられていることがわかる。
42
+
43
+ PCAの前に標準化を行うことでモデルの性能を大きく向上させることができる。