0
我想训练一个非常不平衡的数据集上的随机森林分类器2类(良性恶性)。如何在Orange中使用随机森林分类器的样本权重?
我已经看过并遵循上一个问题(How to set up and use sample weight in the Orange python package?)的代码,并尝试为少数类数据实例设置各种更高的权重,但是我得到的分类器工作方式完全相同。
我的代码:
data = Orange.data.Table(filename)
st = Orange.classification.tree.SimpleTreeLearner(min_instances=3)
forest = Orange.ensemble.forest.RandomForestLearner(learner=st, trees=40, name="forest")
weight = Orange.feature.Continuous("weight")
weight_id = -10
data.domain.add_meta(weight_id, weight)
data.add_meta_attribute(weight, 1.0)
for inst in data:
if inst[data.domain.class_var]=='malign':
inst[weight]=100
classifier = forest(data, weight_id)
我缺少的东西?