Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Orange python包中设置和使用示例权重?_Python_Orange - Fatal编程技术网

如何在Orange python包中设置和使用示例权重?

如何在Orange python包中设置和使用示例权重?,python,orange,Python,Orange,我不熟悉用于数据挖掘的Orange python包。我用的是橙色2.7 我的数据集有一个二进制目标(好的和坏的)。对好的实例进行向下采样,采样权重为10。如何在Windows和Linux版本的Orange中设置和使用权重进行分类分析?谢谢你的帮助 您必须向数据中添加一个新的元列,其中包含实例权重(请参见和)。存储元列的id并使用该元id调用学习者 import Orange iris = Orange.data.Table("iris") # Add some weights to the ir

我不熟悉用于数据挖掘的Orange python包。我用的是橙色2.7


我的数据集有一个二进制目标(好的和坏的)。对好的实例进行向下采样,采样权重为10。如何在Windows和Linux版本的Orange中设置和使用权重进行分类分析?谢谢你的帮助

您必须向数据中添加一个新的元列,其中包含实例权重(请参见和)。存储元列的id并使用该元id调用学习者

import Orange
iris = Orange.data.Table("iris")
# Add some weights to the iris dataset
weight = Orange.feature.Continuous("weight")
weight_id = -10
iris.domain.add_meta(weight_id, weight)
iris.add_meta_attribute(weight, 1.0)
for i in range(50, 150):
     iris[i][weight] = 10

# Train a tree classifier on weighted data.
clsf = Orange.classification.tree.TreeLearner(iris, weight_id)

# Evaluate learner performance on weighted data
results = Orange.evaluation.testing.cross_validation(
    [Orange.classification.tree.TreeLearner,
     Orange.classification.bayes.NaiveLearner],
    (iris, weight_id)  # Note how you pass the weight id to testing functions
)
auc = Orange.evaluation.scoring.AUC(results)
ca = Orange.evaluation.scoring.CA(results)