【发布时间】:2021-01-16 17:38:28
【问题描述】:
library(gbm)
gbm.fit
我运行上面的代码来查看gbm.fit的源代码。看起来函数的“肉”在这一行:
gbm.obj <- .Call("gbm_fit", Y = as.double(y), Offset = as.double(offset),
X = as.double(x), X.order = as.integer(x.order), weights = as.double(w),
Misc = as.double(Misc), cRows = as.integer(cRows), cCols = as.integer(cCols),
var.type = as.integer(var.type), var.monotone = as.integer(var.monotone),
distribution = as.character(distribution.call.name),
n.trees = as.integer(n.trees), interaction.depth = as.integer(interaction.depth),
n.minobsinnode = as.integer(n.minobsinnode), n.classes = as.integer(nClass),
shrinkage = as.double(shrinkage), bag.fraction = as.double(bag.fraction),
nTrain = as.integer(nTrain), fit.old = as.double(NA),
n.cat.splits.old = as.integer(0), n.trees.old = as.integer(0),
verbose = as.integer(verbose), PACKAGE = "gbm")
据我所知,.Call 正在将一个 R 对象传递给 C/C++ 代码。我对有一个名为gbm_fit 的 C/C++ 函数吗?我究竟在哪里可以找到这个源代码?我试过四处寻找https://rdrr.io/cran/gbm/src/R/gbm.fit.R,但似乎找不到 C/C++ 函数的实际源代码。我也下载了“gbm_2.1.8.tgz”但是找不到源代码。
【问题讨论】: