ProbSVMExperiment Class Reference

#include <prob-svm-experiment.h>

Inheritance diagram for ProbSVMExperiment:

Experiment List of all members.

Detailed Description

Runs an experiment using LIBSVM.

Similar to SVMExperiment, but reports the posterior probabilities of each class for each test example.

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

 ProbSVMExperiment (vector< LabeledIndex > training, vector< LabeledIndex > testing, const KernelMatrix &kernel, double c)
virtual ~ProbSVMExperiment ()
virtual void Train ()
 Train a model (if applicable).
virtual int Test ()
 Make predictions for each testing example.
double GetProbability (int test_index, int which_class)
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< LabeledIndextraining_
vector< LabeledIndextesting_


Constructor & Destructor Documentation

ProbSVMExperiment ( vector< LabeledIndex training,
vector< LabeledIndex testing,
const KernelMatrix kernel,
double  c 
)

~ProbSVMExperiment (  )  [virtual]


Member Function Documentation

void Train (  )  [virtual]

Train a model (if applicable).

Implements Experiment.

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.

double GetProbability ( int  test_index,
int  which_class 
)

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>.


Member Data Documentation

vector<LabeledIndex> training_ [protected, inherited]

vector<LabeledIndex> testing_ [protected, inherited]


The documentation for this class was generated from the following files:
Generated on Wed May 2 11:17:13 2007 for libpmk by  doxygen 1.5.1