【问题标题】:What is the type="prob" in the predict function?predict 函数中的 type="prob" 是什么?
【发布时间】:2018-02-08 20:35:23
【问题描述】:

predict() 函数的类型参数

预测函数中的 type="prob" 参数有什么作用? 我是我的代码示例:

rf <- randomForest( Creditability ~. , data=train)      
rf2 <- randomForest( Creditability ~. , data=train2)      


prediction <- predict(rf, test)
prob_prediction <- predict(rf,test,type="prob")

prediction2 <- predict(rf2, test2)

【问题讨论】:

    标签: r


    【解决方案1】:

    根据文档 (http://ugrad.stat.ubc.ca/R/library/randomForest/html/predict.randomForest.html):

    type:响应之一,概率。或投票,表明输出的类型: 预测值、类别概率矩阵或投票矩阵 计数。类是允许的,但会自动转换为“响应”, 为了向后兼容。

    【讨论】:

      猜你喜欢
      • 2015-07-11
      • 2019-08-21
      • 2021-01-15
      • 2011-03-11
      • 2018-12-25
      • 2012-12-18
      • 1970-01-01
      • 2012-04-22
      • 1970-01-01
      相关资源
      最近更新 更多