gpt4 book ai didi

opencv - 如何在 opencv svm 中定义权重

转载 作者:太空宇宙 更新时间:2023-11-03 21:14:03 25 4
gpt4 key购买 nike

我有一个关于支持向量机权重的简单问题。我正在进行二元分类。我想为两个类(class)设置不同的权重。我的代码是这样的

Mat weights = (Mat_<double>(2,1)<<1,2);
CvMat weight = weights;
param.class_weights = &weight;

我想知道哪个权重适用于哪个类(class)?我不是从 opencv 文档中得到的。谢谢。

最佳答案

classWeights – Optional weights in the C_SVC problem , assigned to particular classes. They are multiplied by C so the parameter C of class #i becomes classWeights(i) * C. Thus these weights affect the misclassification penalty for different classes. The larger weight, the larger penalty on misclassification of data from the corresponding class.

关于opencv - 如何在 opencv svm 中定义权重,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26940020/

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