gpt4 book ai didi

r - R中RandomForest包中的RandomForest函数中的参数 'classwt'代表什么?

转载 作者:行者123 更新时间:2023-12-02 03:57:20 25 4
gpt4 key购买 nike

randomforest::randomforest() 的帮助页面显示:

"classwt - Priors of the classes. Need not add up to one. Ignored for regression."

当您有大量不平衡数据时,可以设置classwt参数来帮助,即。类(class)的先验差异很大?

在具有 3 个类别且先验向量等于 (p1,p2,p3) 的数据集上训练模型时,应如何设置 classwt,并且在测试集中先验向量为 (q1,q2) ,q3)?

最佳答案

could setting classwt parameter help when you have heavy unbalanced data - priors of classes differs strongly?

是的,设置 classwt 的值对于不平衡的数据集可能很有​​用。我同意 joran 的观点,即这些值被转换为采样训练数据的概率(根据 Breiman 在其原始文章中的论点)。

How set classwt when in training dataset with 3 classes you have vector of priors equal to (p1,p2,p3), and in test set priors are (q1,q2,q3)?

对于训练,您可以简单地指定

rf <- randomForest(x=x, y=y, classwt=c(p1,p2,p3))

对于测试集,不能使用先验:1)randomForest包的predict方法中没有这样的选项; 2)权重仅对模型训练有意义,对预测没有意义。

关于r - R中RandomForest包中的RandomForest函数中的参数 'classwt'代表什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10112678/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com