【发布时间】:2018-11-17 00:31:24
【问题描述】:
尝试在 R 中使用 gain() 函数时出现此错误:
“警告:不同的预测值少于请求的组。”我使用了 summary() 函数来确保我要比较的两个数据框大小相同。
【问题讨论】:
-
您应该包含库 gain() 的来源,并向我们展示您使用的导致警告的编码。
尝试在 R 中使用 gain() 函数时出现此错误:
“警告:不同的预测值少于请求的组。”我使用了 summary() 函数来确保我要比较的两个数据框大小相同。
【问题讨论】:
if (num.groups < groups) { #Just return all distinct scores
warning("Warning: Fewer distinct predicted values than groups requested")
pred.group<-rank(-1*predicted,ties.method="min")
} else if (num.groups == groups) { #Just return all distinct scores
pred.group<-rank(-1*predicted,ties.method="min")
} else {
num.groups<-groups
pred.rank<-total.n+1-rank(predicted,ties.method=ties.method)
pred.group<-ceiling(pred.rank/(total.n/groups)) }
【讨论】: