最近傍識別器の演習
-
- Matlab か Octave をインストールする.
-
- Download stu-hikkoshiset.2001271132.tgz and find a folder names "mfiles". Many matlab functions are under the folder "mfiles". Put the functions somewhere and add the directories to the path variable for Matlab or Octave.
Download hayuci13a.zip. This file contains five data files: yXT_car.csv, yXT_seeds.csv, yXT_wine.csv, yXT_winequality-white.csv, yXT_yeast.csv. Each line corresponds to one example. The format is
Class, Feature1, Feature2,... , Feature n
Do the followings:
-
- データセット wine に対して, 最初の行の例題を評価用, 残りの行の例題を訓練用として, 最近傍識別を行え. ただし,k-最近傍識別器 の近傍数は k=1 とせよ.
-
- 各データセットに対して, 最初の行の例題を評価用, 残りの行の例題を訓練用として, 最近傍識別を行え. ただし,k-最近傍識別器 の近傍数は k=1 とせよ.
-
- データセット wine に対して, 各クラスのデータを訓練用と評価用を 7:3 にランダムに分けよ.
-
- データセット wine に対して, k-最近傍識別器 の k=1 とし,評価用データの識別率を出せ.
-
-
- を10回繰り返して,識別率の平均値と標準偏差を算出せよ.
-
-
- 各データセットに対して,各クラスのデータを訓練用と評価用を 7:3 にランダムに分け,k-最近傍識別器 の k=1 とし, 評価用データの識別率を出せ.
-
- 各データセットに対して,6. を10回繰り返して,識別率の平均値と標準偏差を算出せよ.
-
- k-最近傍識別器 の k=1,2,3,4,5 を試せ. ただし,重みつきの voting をせよ. 重みは exp( - (ユークリッド距離)^2/(2σ^2)) で求めよ. ただし,σは訓練用データの距離値の中間値とする. これは,距離行列 D をまず計算し,$median(D(:))$ から求める.
- Translation into English: Test k-NN classifiers with k=1,2,3,4,5. Therein, the weighted voting should be used. The weight is defined as
exp(-(d^2/2\sigma^2) )
where d is the Euclidean distance and
\sigma is the median of training data.
In particular,
- 余裕があったら,C言語風にコーディングする場合と
行列計算でコーディングする場合とで計算時間を比較して
みてください.
- Translation into English: Compare the computational time of two implementations. The one is that the code does not use matrix computation but use for-loop like C language. The other uses matrix computation.