网站新手和R,提前感谢您的耐心和帮助!
我正在尝试运行Gradient Boosted Machine学习算法来开发一些模型。 (使用https://github.com/ledell/useR-machine-learning-tutorial/blob/master/gradient-boosting-machines.Rmd)
提供的方法到目前为止,我已经阅读了我的数据并下载了必要的组件(gbm,cvAUC)
以下代码:
set.seed(1)
model <- gbm(formula =~ BP_Nopay3_PMT,
distribution = "bernoulli",
data = train,
n.trees = 70,
interaction.depth = 5,
shrinkage = 0.3,
bag.fraction = 0.5,
train.fraction = 1.0,
n.cores = NULL)`
并获得以下结果:
Error in gbm.fit(x, y, offset = offset, distribution = distribution, w = w,
: The number of rows in x does not equal the length of y.
我的研究结果(谷歌:Error in gbm.fit(x, y, offset = offset, distribution = distribution, w = w, : The number of rows in x does not equal the length of y solved
)
让我得出结论,我需要编辑x
或y
参数,但我不知道如何编辑它,因为它是模型语句的结果。
感谢您的帮助!