質問編集履歴
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -59,3 +59,49 @@
|
|
59
59
|
同様にはlasso回帰のcalibrationは書けないのでしょうか?
|
60
60
|
|
61
61
|
library(caret)などを使用した方が良いのでしょうか?(train関数など?)
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
[追記]
|
66
|
+
|
67
|
+
他の方法として、以下の方法を試してみました。
|
68
|
+
|
69
|
+
データベースはres_lasssoという形にしています
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
```R
|
74
|
+
|
75
|
+
ctrl <- trainControl(method = "cv",classProbs=TRUE,number=10,selectionFunction = "best")
|
76
|
+
|
77
|
+
#res_lasso_linar <- train(res_lasso[,-1],res_lasso[,1],method="glm",trControl=fitControl)
|
78
|
+
|
79
|
+
linear_lift <- train(x=res_lasso[,-1],y=res_lasso[,1],
|
80
|
+
|
81
|
+
method = "glm", metric = "ROC",
|
82
|
+
|
83
|
+
trControl = ctrl)
|
84
|
+
|
85
|
+
lift_results <- data.frame(Class = res_lasso[,1])
|
86
|
+
|
87
|
+
lift_results$LINEAR <- predict(linear_lift, res_lasso, type = "prob")[,"Class1"]
|
88
|
+
|
89
|
+
head(lift_results)
|
90
|
+
|
91
|
+
```
|
92
|
+
|
93
|
+
すると、以下のエラーが出てきました。
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
You are trying to do regression and your outcome only has two possible values Are you trying to do classification? If so, use a 2 level factor as your outcome column.Error in evalSummaryFunction(y, wts = weights, ctrl = trControl, lev = classLevels, :
|
98
|
+
|
99
|
+
Error in evalSummaryFunction(y, wts = weights, ctrl = trControl, lev = classLevels, : train()'s use of ROC codes requires class probabilities. See the classProbs option of trainControl()
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
おそらくglmでoutcomeを二値変数にしているので、チューニングがうまくいっていないという意味なのかと思いますが、どこの部分かがわかりません。
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
誰か助けて頂けますと幸いです。
|
1
タグの追加など
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|