为什么在R中使用Cubist包时会出现以下错误?

时间:2015-06-23 13:36:28

标签: r regression decision-tree non-linear-regression

我有一些个人数据集。所以我把它分成变量来预测和预测。 以下是语法:

  l_stmt := q'{insert /*+ NOLOGGING NOWAIT */  
          into  DESTINATION_TABLE
          select *
          from   migr_view.migr_blob@DB_LINK
          where  to_number(regexp_substr(not_key_1 || not_key_2 || not_key_3..., 
          '[[:digit:]]+')) >= }' || i_start_slice || q'{ 
          and to_number(regexp_substr(not_key_1 || not_key_2 || not_key_3..., 
          '[[:digit:]]+')) <  }' || l_end_slice;

我收到以下错误

library(Cubist)
str(A)
'data.frame':   6038 obs. of  3 variables:
 $ ads_return_count : num  7 10 10 4 10 10 10 10 10 9 ...
 $ actual_cpc       : num  0.0678 0.3888 0.2947 0.0179 0.095 ...
 $ is_user_agent_bot: Factor w/ 1 level "False": 1 1 1 1 1 1 1 1 1 1 ...
cubist(A[,c("ads_return_count","is_user_agent_bot")],A[,"actual_cpc"])

我有什么遗失的吗?

2 个答案:

答案 0 :(得分:1)

模拟一些数据以制作可重复的示例:

A=data.frame(ads_return_count=sample(100,10,TRUE), actual_cpc=runif(100), is_user_agent_bot=factor(rep("False",100)))

cubist(A[,c("ads_return_count","is_user_agent_bot")],A[,"actual_cpc"])
cubist code called exit with value 1
Error in strsplit(tmp, "\"")[[1]] : subscript out of bounds

太好了,现在我们在同一页上。

困扰我的是第二个论点,即结果,都是“假的”。我不确定只有一个结果的模型是否有意义。让我们尝试一下两个结果:

> A2=data.frame(ads_return_count=sample(100,10,TRUE), actual_cpc=runif(100), is_user_agent_bot=sample(c("True","False"),100,TRUE))
> cubist(A2[,c("ads_return_count","is_user_agent_bot")],A2[,"actual_cpc"])

Call:
cubist.default(x = A2[, c("ads_return_count", "is_user_agent_bot")], y =
 A2[, "actual_cpc"])

Number of samples: 100 
Number of predictors: 2 

Number of committees: 1 
Number of rules: 1 

我会说这是cubist由于单一结果可能性导致的无法提供的错误消息。

答案 1 :(得分:0)

我的问题与我相同,但事实证明这是一个级别名称,缺少值“”。用文本替换这些级别可以达到目的。

似乎c5.0决策树存在类似问题 C5.0 decision tree - c50 code called exit with value 1