首页 文章

为libsvm-linear内核选择优化参数

提问于
浏览
1

我使用 RBF 内核用于libsvm的ML . 我正在研究为我的数据集探索其他内核 .

有多个参数可以针对特定内核优化每个参数 . C and g 参数用于网格搜索,以选择Cost和gamma的最佳组合 .

-d degree : set degree in kernel function (default 3)
-g gamma : set gamma in kernel function (default 1/num_features)
-r coef0 : set coef0 in kernel function (default 0)
-c cost : set the parameter C of C-SVC, epsilon-SVR, and nu-SVR (default 1)
-n nu : set the parameter nu of nu-SVC, one-class SVM, and nu-SVR (default 0.5)
-p epsilon : set the epsilon in loss function of epsilon-SVR (default 0.1)
-m cachesize : set cache memory size in MB (default 100)
-e epsilon : set tolerance of termination criterion (default 0.001)
-h shrinking : whether to use the shrinking heuristics, 0 or 1 (default 1)
-b probability_estimates : whether to train a SVC or SVR model for probability estimates, 0 or 1 (default 0)
-wi weight : set the parameter C of class i to weight*C, for C-SVC (default 1)

我想知道每个内核的相关参数 . 由于有多个参数可供选择 . 例如: C and g for RBF kernel . 还提供网格大小和参数范围Ex: 10^-3 to 10^11 for C and 10^3 to 10^-13 for g

我的用于RBF内核的perl网格生成器:

for ( $i = -3; $i <= 11; $i += 1 ) {

    for ( $j = 3; $j >= -13; $j += -1 ) {

        my $a = 2**$i;
        my $b = 2**$j;

        $output = "svm-train -c $a -g $b -v 5 $ARGV[0]";

        print  "$output >& ${ARGV[0]}_${a}_${b}.out \n";

    }
}

1 回答

  • 3

    libsvm支持四个内核:linear,poly,rbf和sigmoid(实际上它们不是有效的内核) .

    • 线性:没有参数

    • poly:gamma(> 0,float),coef0(float),degree(> 1,int)

    • rbf:gamma(> 0,float)

    • sigmoid:gamma(> 0,float),coef0(float)

    你不能真正提供通用参数网格,因为它们是数据相关的 .

    C是SVM参数,因此需要始终进行拟合 . 剩余参数不是特定于内核的,您不必担心它们 .

相关问题