37. train関数の実行結果
36
> fit.svm
Support Vector Machines with Radial Basis Function Kernel
146 samples
60 predictors
2 classes: 'M', 'R'
No pre-processing
Resampling: Cross-Validated (10 fold)
Summary of sample sizes: 131, 131, 131, 132, 132, 131, ...
Resampling results across tuning parameters:
C sigma Accuracy Kappa Accuracy SD Kappa SD
0.5 0.01 0.779 0.543 0.0887 0.183
0.5 0.02 0.787 0.562 0.0761 0.153
1 0.01 0.801 0.595 0.0937 0.187
1 0.02 0.849 0.693 0.0969 0.195
1.5 0.01 0.829 0.653 0.079 0.158
1.5 0.02 0.836 0.666 0.0726 0.146
Accuracy was used to select the optimal model using the largest value.
The final values used for the model were sigma = 0.02 and C = 1.
38. train関数の実行結果
37
> fit.svm
Support Vector Machines with Radial Basis Function Kernel
146 samples
60 predictors
2 classes: 'M', 'R'
No pre-processing
Resampling: Cross-Validated (10 fold)
Summary of sample sizes: 131, 131, 131, 132, 132, 131, ...
Resampling results across tuning parameters:
C sigma Accuracy Kappa Accuracy SD Kappa SD
0.5 0.01 0.779 0.543 0.0887 0.183
0.5 0.02 0.787 0.562 0.0761 0.153
1 0.01 0.801 0.595 0.0937 0.187
1 0.02 0.849 0.693 0.0969 0.195
1.5 0.01 0.829 0.653 0.079 0.158
1.5 0.02 0.836 0.666 0.0726 0.146
Accuracy was used to select the optimal model using the largest value.
The final values used for the model were sigma = 0.02 and C = 1.
ハイパーパラメータの
値ごとの評価結果
39. train関数の実行結果
38
> fit.svm
Support Vector Machines with Radial Basis Function Kernel
146 samples
60 predictors
2 classes: 'M', 'R'
No pre-processing
Resampling: Cross-Validated (10 fold)
Summary of sample sizes: 131, 131, 131, 132, 132, 131, ...
Resampling results across tuning parameters:
C sigma Accuracy Kappa Accuracy SD Kappa SD
0.5 0.01 0.779 0.543 0.0887 0.183
0.5 0.02 0.787 0.562 0.0761 0.153
1 0.01 0.801 0.595 0.0937 0.187
1 0.02 0.849 0.693 0.0969 0.195
1.5 0.01 0.829 0.653 0.079 0.158
1.5 0.02 0.836 0.666 0.0726 0.146
Accuracy was used to select the optimal model using the largest value.
The final values used for the model were sigma = 0.02 and C = 1.
Accuracyが
最大のモデルを
最適モデルと判断
40. ハイパーパラメータの決定
39
> fit.svm$bestTune
sigma C
4 0.02 1
> fit.svm$finalModel
Support Vector Machine object of class "ksvm"
SV type: C-svc (classification)
parameter : cost C = 1
Gaussian Radial Basis kernel function.
Hyperparameter : sigma = 0.02
Number of Support Vectors : 121
Objective Function Value : -56.594
Training error : 0
最適な
ハイパーパラメータ
(C=1,sigma=0.02)
最適なハイパーパラメー
タを用いてデータ全体に
対して
構築したモデル
49. 評価指標の変更
(関数twoClassSummaryを用いた評価)
48
> svmFit.tcs
Support Vector Machines with Radial Basis Function Kernel
800 samples
41 predictors
2 classes: 'Bad', 'Good'
No pre-processing
Resampling: Cross-Validated (10 fold)
Summary of sample sizes: 720, 720, 720, 720, 720, 720, ...
Resampling results across tuning parameters:
C ROC Sens Spec ROC SD Sens SD Spec SD
0.25 0.785 0.512 0.845 0.0591 0.0857 0.0484
0.5 0.786 0.496 0.864 0.0584 0.0888 0.0492
1 0.787 0.458 0.886 0.0618 0.106 0.0423
Tuning parameter 'sigma' was held constant at a value of 0.01399623
Sens was used to select the optimal model using the largest value.
The final values used for the model were sigma = 0.014 and C = 0.25.
評価指標が
ROC(AUC),
Sensitivity,
Specityになった!
モデルの選択に
使用する評価指標
がSensitivityに
なった!