prob-svm-experiment.h

Go to the documentation of this file.
00001 // Copyright 2006, Massachusetts Institute of Technology.
00002 // The use of this code is permitted for research only. There is
00003 // absolutely no warranty for this software.
00004 //
00005 // Author: John Lee (jjl@mit.edu)
00006 //
00007 
00008 #ifndef EXPERIMENT_SVM_EXPERIMENT_H
00009 #define EXPERIMENT_SVM_EXPERIMENT_H
00010 
00011 #include "experiment/experiment.h"
00012 #include "kernel/kernel-matrix.h"
00013 #include "util/labeled-index.h"
00014 #include "svm/svm.h"
00015 
00016 using namespace libpmk;
00017 
00018 namespace libpmk_util {
00019 
00021 
00030 class ProbSVMExperiment : public Experiment {
00031  public:
00032    ProbSVMExperiment(vector<LabeledIndex> training,
00033                  vector<LabeledIndex> testing,
00034                  const KernelMatrix& kernel,
00035                  double c);
00036    virtual ~ProbSVMExperiment();
00037    
00038    virtual void Train();
00039    virtual int Test();
00040 
00041    double GetProbability(int test_index, int which_class);
00042 
00043  private:
00044    struct svm_parameter param_;
00045    struct svm_model *model_;
00046 
00047    void SetProbability(int test_index, int which_class, double prob);
00048 
00049    // Vector of length <num_test_examples>.
00050    // Each vector is a vec of length <num_classes>.
00051    vector<vector<double> > probabilities_;
00052    
00053 };
00054 }  // namespace libpmk_util
00055 #endif  // EXPERIMENT_SVM_EXPERIMENT_H

Generated on Wed May 2 11:17:12 2007 for libpmk by  doxygen 1.5.1