35 #ifndef OPENMS_ANALYSIS_SVM_SVMWRAPPER_H 36 #define OPENMS_ANALYSIS_SVM_SVMWRAPPER_H 57 std::vector<std::vector<std::pair<Int, double> > >
sequences;
62 SVMData(std::vector<std::vector<std::pair<Int, double> > >& seqs, std::vector<double>& lbls);
66 bool store(
const String& filename)
const;
68 bool load(
const String& filename);
174 Int train(
struct svm_problem* problem);
193 void saveModel(std::string modelFilename)
const;
203 void loadModel(std::string modelFilename);
210 void predict(
struct svm_problem* problem, std::vector<double>& predicted_labels);
217 void predict(
const SVMData& problem, std::vector<double>& results);
294 static void createRandomPartitions(svm_problem* problem,
Size number, std::vector<svm_problem*>& partitions);
301 static void createRandomPartitions(
const SVMData& problem,
303 std::vector<SVMData>& problems);
307 static svm_problem* mergePartitions(
const std::vector<svm_problem*>& problems,
Size except);
312 static void mergePartitions(
const std::vector<SVMData>& problems,
322 void predict(
const std::vector<svm_node*>& vectors, std::vector<double>& predicted_rts);
328 static void getLabels(svm_problem* problem, std::vector<double>& labels);
334 double performCrossValidation(svm_problem* problem_ul,
336 const bool is_labeled,
337 const std::map<SVM_parameter_type, double>& start_values_map,
338 const std::map<SVM_parameter_type, double>& step_sizes_map,
339 const std::map<SVM_parameter_type, double>& end_values_map,
340 Size number_of_partitions,
342 std::map<SVM_parameter_type, double>& best_parameters,
343 bool additive_step_sizes =
true,
345 String performances_file_name =
"performances.txt",
346 bool mcc_as_performance_measure =
false);
358 double getSVRProbability();
375 static double kernelOligo(
const std::vector<std::pair<int, double> >& x,
376 const std::vector<std::pair<int, double> >& y,
377 const std::vector<double>& gauss_table,
378 int max_distance = -1);
387 static double kernelOligo(
const svm_node* x,
const svm_node* y,
const std::vector<double>& gauss_table,
double sigma_square = 0,
Size max_distance = 50);
392 void getSignificanceBorders(svm_problem* data, std::pair<double, double>& borders,
double confidence = 0.95,
Size number_of_runs = 5,
Size number_of_partitions = 5,
double step_size = 0.01,
Size max_iterations = 1000000);
397 void getSignificanceBorders(
const SVMData& data,
398 std::pair<double, double>& sigmas,
399 double confidence = 0.95,
400 Size number_of_runs = 5,
401 Size number_of_partitions = 5,
402 double step_size = 0.01,
403 Size max_iterations = 1000000);
411 double getPValue(
double sigma1,
double sigma2, std::pair<double, double> point);
422 void getDecisionValues(svm_problem* data, std::vector<double>& decision_values);
430 void scaleData(svm_problem* data,
Int max_scale_value = -1);
432 static void calculateGaussTable(
Size border_length,
double sigma, std::vector<double>& gauss_table);
441 svm_problem* computeKernelMatrix(svm_problem* problem1, svm_problem* problem2);
450 svm_problem* computeKernelMatrix(
const SVMData& problem1,
const SVMData& problem2);
456 void setTrainingSample(svm_problem* training_sample);
461 void setTrainingSample(
SVMData& training_sample);
472 void getSVCProbabilities(
struct svm_problem* problem, std::vector<double>& probabilities, std::vector<double>& prediction_labels);
477 void setWeights(
const std::vector<Int>& weight_labels,
const std::vector<double>& weights);
486 bool nextGrid_(
const std::vector<double>& start_values,
487 const std::vector<double>& step_sizes,
488 const std::vector<double>& end_values,
489 const bool additive_step_sizes,
490 std::vector<double>& actual_values);
492 Size getNumberOfEnclosedPoints_(
double m1,
double m2,
const std::vector<std::pair<double, double> >& points);
497 void initParameters_();
504 static void printToVoid_(
const char* );
521 #endif // OPENMS_ANALYSIS_SVM_SVMWRAPPER_H the C parameter of the svm
Definition: SVMWrapper.h:96
A more convenient string class.
Definition: String.h:57
SVMData training_data_
Definition: SVMWrapper.h:516
svm_model * model_
Definition: SVMWrapper.h:507
svm_problem * training_problem_
Definition: SVMWrapper.h:515
Serves as a wrapper for the libsvm.
Definition: SVMWrapper.h:80
svm_problem * training_set_
Definition: SVMWrapper.h:514
the epsilon parameter for epsilon-SVR
Definition: SVMWrapper.h:98
SVM_kernel_type
Kernel type.
Definition: SVMWrapper.h:106
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
std::vector< std::vector< std::pair< Int, double > > > sequences
Definition: SVMWrapper.h:57
Size border_length_
Definition: SVMWrapper.h:513
Size kernel_type_
Definition: SVMWrapper.h:512
svm_parameter * param_
Definition: SVMWrapper.h:506
Data structure used in SVMWrapper.
Definition: SVMWrapper.h:55
the svm type cab be NU_SVR or EPSILON_SVR
Definition: SVMWrapper.h:93
std::vector< double > gauss_table_
Definition: SVMWrapper.h:510
Definition: SVMWrapper.h:101
the gamma parameter of the POLY, RBF and SIGMOID kernel
Definition: SVMWrapper.h:99
Definition: SVMWrapper.h:100
double sigma_
Definition: SVMWrapper.h:508
the degree for the polynomial- kernel
Definition: SVMWrapper.h:95
std::vector< double > labels
Definition: SVMWrapper.h:58
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
std::vector< std::vector< double > > gauss_tables_
Definition: SVMWrapper.h:511
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:55
int Int
Signed integer type.
Definition: Types.h:103
std::vector< double > sigmas_
Definition: SVMWrapper.h:509
the nu parameter for nu-SVR
Definition: SVMWrapper.h:97
the kernel type
Definition: SVMWrapper.h:94
SVM_parameter_type
Parameters for the svm to be set from outside.
Definition: SVMWrapper.h:91