|
@@ -8,7 +8,8 @@ function svmmodel = libsvm_train ( labels, feat, settings )
|
|
|
% labels -- multi-class labels (#sample x 1)
|
|
|
% feat -- features for training images (#samples x # dimensions)
|
|
|
% settings -- struct for configuring the svm model training, e.g., via
|
|
|
-% 'b_verbose', 's_svm_type', 's_kernel_type', 'f_svm_C', ...
|
|
|
+% 'b_verbose', 's_svm_type', 's_kernel_type', 'f_svm_C',
|
|
|
+% 'f_rbf_gamma', 'b_svm_shrinking' ...
|
|
|
%
|
|
|
% OUTPUT:
|
|
|
% svmmodel -- cell ( #classes x 1 ), every model entry is obtained via
|
|
@@ -57,8 +58,14 @@ function svmmodel = libsvm_train ( labels, feat, settings )
|
|
|
%
|
|
|
b_weightBalancing = getFieldWithDefault ( settings, 'b_weightBalancing', false);
|
|
|
|
|
|
+ % RBF bandwidth parameter (default 1)
|
|
|
+ f_rbf_gamma = getFieldWithDefault ( settings, 'f_rbf_gamma', 1);
|
|
|
+ libsvm_options = sprintf('%s -g %f', libsvm_options, f_rbf_gamma);
|
|
|
|
|
|
-
|
|
|
+ % do we want to use the shrinking option? (default: no)
|
|
|
+ b_svm_shrinking = getFieldWithDefault ( settings, 'b_svm_shrinking', false);
|
|
|
+ libsvm_options = sprintf('%s -h %d', libsvm_options, b_svm_shrinking);
|
|
|
+
|
|
|
uniqueLabels = unique ( labels );
|
|
|
i_numClasses = size ( uniqueLabels,1);
|
|
|
|