带rbf核的sklearn SVC在j上的移植

2024-09-28 22:22:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经使用sklearn在python中训练了一个rbf内核SVM,现在正在将其移植到java进行生产。你知道吗

在阅读SVC documentation时,我遇到了决策函数:

enter image description here

这似乎表明为了评估SVC,我必须知道每个训练样本的权重,然而SVC仅通过dual_coef_属性公开支持向量的权重。你知道吗

有没有办法解决这个问题?你知道吗


Tags: 属性documentationjavasklearn内核向量权重svm
1条回答
网友
1楼 · 发布于 2024-09-28 22:22:55

你不需要知道每个训练样本的权重。你只需要支持向量的权重。你知道吗

原因是,如果向量x_i不是支持向量,那么alpha_i=0(见第5 here页),因此y_i*alpha_i=0。因此,在分类过程中永远不要使用这样的x_i(一旦你安装了svm)。你知道吗

其余参数可通过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.

相关问题 更多 >