插入符号nnet:logloss不适用于twoClassSummary

插入符号nnet:logloss不适用于twoClassSummary,r,neural-network,r-caret,R,Neural Network,R Caret,我有一个训练数据集 Out Revolver Ratio Num ... 0 1 0.766127 0.802982 0 ... 1 0 0.957151 0.121876 1 2 0 0.658180 0.085113 0 3 0 0.233810 0.036050 3 4 1 0.907239 0.024926 5 结果变量Out是二进制的,只接受值0或1Num不是一个因素 然

我有一个训练数据集

    Out  Revolver   Ratio     Num ...
0   1    0.766127   0.802982  0   ...
1   0    0.957151   0.121876  1 
2   0    0.658180   0.085113  0 
3   0    0.233810   0.036050  3 
4   1    0.907239   0.024926  5 
结果变量
Out
是二进制的,只接受值0或1
Num
不是一个因素

然后,我尝试使用插入符号运行
nnet
。我想最终尝试一下
nnGrid
,但我只想先确保它能正常工作:

nnTrControl=trainControl(method = "cv", classProbs = TRUE, summaryFunction = twoClassSummary, 
    number = 2,verboseIter = TRUE, returnData = FALSE, returnResamp = "all") 
#nnGrid = expand.grid(.size=c(1,4,7),.decay=c(0,0.001,0.1))

Outf<-factor(training$Out)
model <- train(Outf~ Revolver+Ratio+Num, data=training, method='nnet',
           trControl = nnTrControl, metric="logLoss")#, tuneGrid=nnGrid)
但是,我以前使用过
插入符号
,并得到了这个错误,我通过使用
make.names
解决了这个问题。因此,当我尝试以下方法时:

yCat<-make.names(training$Out, unique=FALSE, allow_=TRUE)
mnn <- model.matrix( ~Revolver + Ratio + Num, data = training)
model <- train(y=yCat, x=mnn, method='nnet',
           trControl = nnTrControl, metric="logLoss")#, tuneGrid=nnGrid)
但我不明白为什么它不根据
logLoss
进行评估

如果我用它来预测测试集

probs<-predict(model, newdata=testSet, type="prob")
我该如何解决这个问题

The metric "logLoss" was not in the result set. ROC will be used instead.
probs<-predict(model, newdata=testSet, type="prob")
 Error in eval(expr, envir, enclos) : object '(Intercept)' not found