をチューニングするとき、私は言葉の袋から始まる予測のためのSVMを訓練し、チューニングするCパラメータをキャレットを使用していたが、それは私にエラーを与えてい成果のラベルのようにdoes't:キャレットは、SCV
弓。
model.svm.tune <- train(Training.match ~ ., data = data.frame(
Training.match = factor(Training.Data.old$Training.match, labels = c('no match', 'match')),
Text.features.dtm.df) %>%
filter(Training.Data.old$Data.tipe == 'train'),
method = 'svmRadial',
tuneLength = 9,
preProc = c("center","scale"),
metric="ROC",
trControl = trainControl(
method="repeatedcv",
repeats = 5,
summaryFunction = twoClassSummary,
classProbs = T))
Error: At least one of the class levels is not a valid R variable name; This will cause errors when class probabilities are generated because the variables names will be converted to no.match, match . Please use factor levels that can be used as valid R variable names (see ?make.names for help).
元e1071中:: SVM()関数は、問題を与えるものではありません、したがって、私はエラーがチューニングFASEで発生すると仮定します
bow.model.svm.tune <- svm(Training.match ~ ., data = data.frame(
Training.match = factor(Training.Data.old$Training.match, labels = c('no match', 'match')),
Text.features.dtm.df) %>%
filter(Training.Data.old$Data.tipe == 'train'))
データは、単に成果因子であります
'data.frame': 1796 obs. of 1697 variables:
$ Training.match : Factor w/ 2 levels "no match","match": 2 1 1 1 1 1 1 1 2 1 ...
$ azienda : num 0.12 0 0 0 0 ...
$ bus : num 0.487 0 0 0 0 ...
$ locale : num 0.275 0 0 0 0 ...
$ martini : num 0.852 0.741 0.947 0.947 0.501 ...
$ osp : num 0.339 0 0 0 0 ...
$ ospedale : num 0.0389 0.0676 0.0864 0.0864 0.0915 ...
おかげ
:変数とTFIDFのリストは、言葉ベクトルを変換しました
あなたは正しいです(あなたが関数Dを書いてから期待通りです)。ありがとうtopepo! – Bakaburg