【发布时间】:2023-11-12 13:06:02
【问题描述】:
我从事概率校准工作。我正在使用一种称为generalized additive models 的概率映射方法。
我写的算法是:
probMapping = function(x, y, datax, datay) {
if(length(x) < length(y))stop("train smaller than test")
if(length(datax) < length(datay))stop("train smaller than test")
datax$prob = x # trainset: data and raw probabilities
datay$prob = y # testset: data and raw probabilities
prob_map = gam(Target ~ prob, data = datax, familiy = binomial, trace = TRUE)
prob_map_prob = predict(prob_map, newdata = datay, type = "prob")
# return(str(datax))
return(prob_map_prob)
}
我使用的包是mgcv。
- x - 对
train数据集的预测 - y - 对
test数据集的预测 - datax -
traindata - 数据-
testdata
问题:
- 输出值不在 0 和 1 之间
-
我收到以下警告消息:
In predict.gam(prob_map, newdata = datay, type = "prob") : Unknown type, reset to terms.
【问题讨论】:
标签: r statistics probability prediction calibration