2024-09-28 22:22:55 发布
网友
我已经使用sklearn在python中训练了一个rbf内核SVM,现在正在将其移植到java进行生产。你知道吗
在阅读SVC documentation时,我遇到了决策函数:
这似乎表明为了评估SVC,我必须知道每个训练样本的权重,然而SVC仅通过dual_coef_属性公开支持向量的权重。你知道吗
dual_coef_
有没有办法解决这个问题?你知道吗
你不需要知道每个训练样本的权重。你只需要支持向量的权重。你知道吗
原因是,如果向量x_i不是支持向量,那么alpha_i=0(见第5 here页),因此y_i*alpha_i=0。因此,在分类过程中永远不要使用这样的x_i(一旦你安装了svm)。你知道吗
x_i
alpha_i=0
y_i*alpha_i=0
其余参数可通过svm属性访问,如documentation中所述:
This parameters can be accessed through the members dual_coef_ which holds the product y_i*alpha_i, support_vectors_ which holds the support vectors, and intercept_ which holds the independent term rho.
y_i*alpha_i
support_vectors_
intercept_
rho
你不需要知道每个训练样本的权重。你只需要支持向量的权重。你知道吗
原因是,如果向量
x_i
不是支持向量,那么alpha_i=0
(见第5 here页),因此y_i*alpha_i=0
。因此,在分类过程中永远不要使用这样的x_i
(一旦你安装了svm)。你知道吗其余参数可通过svm属性访问,如documentation中所述:
相关问题 更多 >
编程相关推荐