#include <svm-experiment.h>
Inheritance diagram for SVMExperiment:

This will use a one-vs-all classifier.
For more information about LIBSVM, please see
Chih-Chung Chang and Chih-Jen Lin, LIBSVM : a library for support vector machines, 2001. Software available at http://www.csie.ntu.edu.tw/~cjlin/libsvm
Public Member Functions | |
| SVMExperiment (vector< LabeledIndex > training, vector< LabeledIndex > testing, const KernelMatrix &kernel, double c) | |
| SVMExperiment (vector< LabeledIndex > training, const KernelMatrix &training_matrix, vector< LabeledIndex > testing, const Matrix &testing_matrix, double c) | |
| virtual | ~SVMExperiment () |
| virtual void | Train () |
| Train a model (if applicable). | |
| virtual int | Test () |
| Make predictions for each testing example. | |
| int | GetPrediction (int test_index) const |
| Returns the predicted value of the <test_index>th test example. | |
| int | GetNumCorrect () const |
| Get the total number of testing examples that were correctly classified. | |
| int | GetNumCorrect (int label) const |
| Get the number of testing examples that had label <label> that were also correctly classified. | |
| int | GetNumTestExamples () const |
| Get the total number of test examples. | |
| int | GetNumTestExamples (int label) const |
| Get the number of text examples with label <label>. | |
| double | GetAccuracy () const |
| Same as GetNumCorrect() / GetNumTestExamples(). | |
| double | GetAccuracy (int label) const |
| Same as GetNumCorrect(label) / GetNumTestExamples(label). | |
Protected Member Functions | |
| double | GetKernelValue (int row, int col) const |
| Get a kernel value (wrapper for KernelMatrix). | |
| double | GetKernelValue (const LabeledIndex &row, const LabeledIndex &col) const |
| Get the kernel value corresponding to the given LabeledIndices. | |
| void | SetPrediction (int test_index, int prediction) |
Protected Attributes | |
| vector< LabeledIndex > | training_ |
| vector< LabeledIndex > | testing_ |
| SVMExperiment | ( | vector< LabeledIndex > | training, | |
| vector< LabeledIndex > | testing, | |||
| const KernelMatrix & | kernel, | |||
| double | c | |||
| ) |
<kernel> includes pairwise kernel values for all data (both training and testing). The LabeledIndices in <training> and <testing> specify which row of the kernel to look at.
| SVMExperiment | ( | vector< LabeledIndex > | training, | |
| const KernelMatrix & | training_matrix, | |||
| vector< LabeledIndex > | testing, | |||
| const Matrix & | testing_matrix, | |||
| double | c | |||
| ) |
<training_matrix> is a kernel matrix for training examples only. Let N be the number of training examples. Then <testing_matrix> is a NxM Matrix where M is the number of test examples, and the testing[i][j] is the kernel value between the i'th training example and the j'th test example. <training> must be N-dimensional and <testing> must be M-dimensional.
| ~SVMExperiment | ( | ) | [virtual] |
| void Train | ( | ) | [virtual] |
| int Test | ( | ) | [virtual] |
Make predictions for each testing example.
Returns the number of test examples that were correct. When you implement Test(), you must report results via SetPrediction().
Implements Experiment.
| int GetPrediction | ( | int | test_index | ) | const [inherited] |
Returns the predicted value of the <test_index>th test example.
Can only call this after Test() is called.
| int GetNumCorrect | ( | ) | const [inherited] |
Get the total number of testing examples that were correctly classified.
| int GetNumCorrect | ( | int | label | ) | const [inherited] |
Get the number of testing examples that had label <label> that were also correctly classified.
| int GetNumTestExamples | ( | ) | const [inherited] |
Get the total number of test examples.
| int GetNumTestExamples | ( | int | label | ) | const [inherited] |
Get the number of text examples with label <label>.
| double GetAccuracy | ( | ) | const [inherited] |
Same as GetNumCorrect() / GetNumTestExamples().
| double GetAccuracy | ( | int | label | ) | const [inherited] |
Same as GetNumCorrect(label) / GetNumTestExamples(label).
| double GetKernelValue | ( | int | row, | |
| int | col | |||
| ) | const [protected, inherited] |
Get a kernel value (wrapper for KernelMatrix).
| double GetKernelValue | ( | const LabeledIndex & | row, | |
| const LabeledIndex & | col | |||
| ) | const [protected, inherited] |
Get the kernel value corresponding to the given LabeledIndices.
| void SetPrediction | ( | int | test_index, | |
| int | prediction | |||
| ) | [protected, inherited] |
Call this to tell Experiment's internals that the test example at <test_index> was classified as <prediction>.
vector<LabeledIndex> training_ [protected, inherited] |
vector<LabeledIndex> testing_ [protected, inherited] |
1.5.1