Kaggle R内核运行cubist函数报找不到函数错误的技术问询
报错原因及解决方案
1 核心报错原因
could not find function "cubist" 错误出现的核心原因是当前R环境未安装、未加载Cubist扩展包,cubist函数不属于caret包的内置函数,是独立的Cubist包提供的功能。
2 解决步骤
- 第一步:先安装Cubist包,在notebook中运行以下代码:
install.packages("Cubist")
- 第二步:加载已安装的Cubist包:
library(Cubist)
- 第三步:修正代码中的参数拼写错误,原代码写的
committeess多了一个s,正确参数名为committees,修正后完整运行代码如下:
# prepare the data transform using training data set.seed(7) x <- dataset[, 1:13] y <- dataset[, 14] preprocessParams <- preProcess(x, method = c("BoxCox")) transX <- predict(preprocessParams, x) #train the final model finalModel <- cubist(x = transX, y = y, committees = 25) summary(finalModel)
内容的提问来源于stack exchange,提问作者Andile
相关产品推荐
相关产品推荐

