00001
00002
00003
00004
00005
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
00050
00051 vector<vector<double> > probabilities_;
00052
00053 };
00054 }
00055 #endif // EXPERIMENT_SVM_EXPERIMENT_H