SVM_libsvm.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef _LIBSVM_H
00037 #define _LIBSVM_H
00038
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042
00043 #include "kernel/Kernel.h"
00044
00046 struct svm_node
00047 {
00049 int index;
00050 };
00051
00053 struct svm_problem
00054 {
00056 int l;
00058 double *y;
00060 struct svm_node **x;
00061 };
00062
00063 enum { C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR };
00064 enum { LINEAR, POLY, RBF, SIGMOID, PRECOMPUTED };
00065
00067 struct svm_parameter
00068 {
00070 int svm_type;
00072 int kernel_type;
00074 CKernel* kernel;
00076 int degree;
00078 double gamma;
00080 double coef0;
00081
00082
00084 double cache_size;
00086 double eps;
00088 double C;
00090 int nr_weight;
00092 int *weight_label;
00094 double* weight;
00096 double nu;
00098 double p;
00100 int shrinking;
00101 };
00102
00104 struct svm_model
00105 {
00107 svm_parameter param;
00109 int nr_class;
00111 int l;
00113 svm_node **SV;
00115 double **sv_coef;
00117 double *rho;
00118
00119
00120
00122 int *label;
00126 int *nSV;
00127
00131 int free_sv;
00133 double objective;
00134 };
00135
00136
00137
00138 struct svm_model *svm_train(const struct svm_problem *prob,
00139 const struct svm_parameter *param);
00140
00141 double svm_predict(const struct svm_model *model, const struct svm_node *x);
00142
00143 void svm_destroy_model(struct svm_model *model);
00144
00145 const char *svm_check_parameter(const struct svm_problem *prob, const struct svm_parameter *param);
00146
00147 #ifdef __cplusplus
00148 }
00149 #endif
00150
00151 #endif