40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
|
Introduction
|
||
|
============
|
||
|
|
||
|
This tool provides a simple interface to LIBSVM with instance weight support
|
||
|
|
||
|
Installation
|
||
|
============
|
||
|
|
||
|
Please check README for the detail.
|
||
|
|
||
|
Usage
|
||
|
=====
|
||
|
|
||
|
matlab> model = svmtrain(training_weight_vector, training_label_vector, training_instance_matrix, 'libsvm_options')
|
||
|
|
||
|
-training_weight_vector:
|
||
|
An m by 1 vector of training weights. (type must be double)
|
||
|
-training_label_vector:
|
||
|
An m by 1 vector of training labels. (type must be double)
|
||
|
-training_instance_matrix:
|
||
|
An m by n matrix of m training instances with n features. (type must be double)
|
||
|
-libsvm_options:
|
||
|
A string of training options in the same format as that of LIBSVM.
|
||
|
|
||
|
Examples
|
||
|
========
|
||
|
|
||
|
Train and test on the provided data heart_scale:
|
||
|
|
||
|
matlab> [heart_scale_label, heart_scale_inst] = libsvmread('../heart_scale');
|
||
|
matlab> heart_scale_weight = load('../heart_scale.wgt');
|
||
|
matlab> model = svmtrain(heart_scale_weight, heart_scale_label, heart_scale_inst, '-c 1');
|
||
|
matlab> [predict_label, accuracy, dec_values] = svmpredict(heart_scale_label, heart_scale_inst, model); % test the training data
|
||
|
|
||
|
Train and test without weights:
|
||
|
|
||
|
matlab> model = svmtrain([], heart_scale_label, heart_scale_inst, '-c 1');
|
||
|
|
||
|
|