Libsvm:工具/轻松.py

2024-04-19 05:54:21 发布

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

脚本工具/轻松.py只使用rbf核。如何更改此脚本以使用另一个内核(尤其是线性内核)执行实验?在

谢谢


Tags: 工具py脚本线性内核rbf
1条回答
网友
1楼 · 发布于 2024-04-19 05:54:21

您需要传递svm-train [options] training_set_file [model_file]您要为其键入的选项。 源代码中的自述文件:

options:
-s svm_type : set type of SVM (default 0)
    0   C-SVC
    1   nu-SVC
    2   one-class SVM
    3   epsilon-SVR
    4   nu-SVR
-t kernel_type : set type of kernel function (default 2)
    0   linear: u'*v
    1   polynomial: (gamma*u'*v + coef0)^degree
    2   radial basis function: exp(-gamma*|u-v|^2)
    3   sigmoid: tanh(gamma*u'*v + coef0)
    4   precomputed kernel (kernel values in training_set_file)

因此,线性将是-t 0

自述文件中还列出了其他选项,可以更改每个内核函数中使用的参数。在

相关问题 更多 >