train中的“脱字符”包错误:“所有准确性度量值均丢失”

问题描述

我正在使用'caret'包和'polr'包来训练模型(进行有序逻辑回归)。这是我的设置:

fitControl <- trainControl(
    method = "repeatedcv",number = 5,repeats = 5)

set.seed(825)
ordinallogitfit <- train(BTC ~ 
                           TallyZero3 + LastMove:ConsecUp + LastMove:ConsecDown +
                           TallyUp1:ConsecDown + LastMove:UpMaxPoint,data = training,method = "polr",trControl = fitControl,verbose = TRUE)

运行此命令时,将得到以下输出

Something is wrong; all the Accuracy metric values are missing:
    Accuracy       Kappa    
 Min.   : NA   Min.   : NA  
 1st Qu.: NA   1st Qu.: NA  
 Median : NA   Median : NA  
 Mean   :NaN   Mean   :NaN  
 3rd Qu.: NA   3rd Qu.: NA  
 Max.   : NA   Max.   : NA  
 NA's   :5     NA's   :5  
Error: Stopping
In addition: There were 14 warnings (use warnings() to see them)
warnings()
Warning messages:
1: model fit Failed for Fold1.Rep1: method=logistic Error in family$linkfun(mustart) : 
  Argument mu must be a nonempty numeric vector

2: In glm.fit(X,y1,wt,family = binomial("probit"),offset = offset) :
  no observations @R_80_4045@ive at iteration 1
3: glm.fit: algorithm did not converge
4: model fit Failed for Fold1.Rep1: method=probit Error : object of type 'closure' is not subsettable

5: In glm.fit(X,offset = offset) :
  no observations @R_80_4045@ive at iteration 1
6: glm.fit: algorithm did not converge
7: model fit Failed for Fold1.Rep1: method=loglog Error : object of type 'closure' is not subsettable

8: In glm.fit(X,offset = offset) :
  no observations @R_80_4045@ive at iteration 1
9: glm.fit: algorithm did not converge
10: model fit Failed for Fold1.Rep1: method=cloglog Error : object of type 'closure' is not subsettable

11: In glm.fit(X,family = binomial("cauchit"),offset = offset) :
  no observations @R_80_4045@ive at iteration 1
12: glm.fit: algorithm did not converge
13: model fit Failed for Fold1.Rep1: method=cauchit Error : object of type 'closure' is not subsettable

14: In nominalTrainWorkflow(x = x,y = y,wts = weights,info = trainInfo,... :
  There were missing values in resampled performance measures.

最后一条消息似乎是最重要的消息,但我不知道该怎么办。我的数据没有NA,也没有无限值。我的反应变量表示为3个级别的因子。我所有的输入变量都是整数(不是分类变量,而只是整数/计数)。

错误原因是什么,如何解决

非常感谢您!

编辑:我只是尝试直接使用polr()函数,并且没有错误-看起来这一定是带有'插入符'包本身的东西。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)