【发布时间】:2015-06-28 18:44:44
【问题描述】:
我正在尝试在具有 2 个类别(良性-恶性)的非常不平衡的数据集上训练随机森林分类器。
我已经看到并遵循了上一个问题 (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)
我错过了什么吗?
【问题讨论】:
标签: orange