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 DOXYGEN_SHOULD_SKIP_THIS
00037
00038 #ifndef _LIBSVM_H
00039 #define _LIBSVM_H
00040
00041 #include "kernel/Kernel.h"
00042
00044 struct svm_node
00045 {
00047 int32_t index;
00048 };
00049
00051 struct svm_problem
00052 {
00054 int32_t l;
00056 float64_t *y;
00058 struct svm_node **x;
00059 };
00060
00061 enum { C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR };
00062 enum { LINEAR, POLY, RBF, SIGMOID, PRECOMPUTED };
00063
00065 struct svm_parameter
00066 {
00068 int32_t svm_type;
00070 int32_t kernel_type;
00072 CKernel* kernel;
00074 int32_t degree;
00076 float64_t gamma;
00078 float64_t coef0;
00079
00080
00082 float64_t cache_size;
00084 float64_t eps;
00086 float64_t C;
00088 int32_t nr_weight;
00090 int32_t *weight_label;
00092 float64_t* weight;
00094 float64_t nu;
00096 float64_t p;
00098 int32_t shrinking;
00099 };
00100
00102 struct svm_model
00103 {
00105 svm_parameter param;
00107 int32_t nr_class;
00109 int32_t l;
00111 svm_node **SV;
00113 float64_t **sv_coef;
00115 float64_t *rho;
00116
00117
00118
00120 int32_t *label;
00124 int32_t *nSV;
00125
00129 int32_t free_sv;
00131 float64_t objective;
00132 };
00133
00134
00135
00136 struct svm_model *svm_train(
00137 const struct svm_problem *prob, const struct svm_parameter *param);
00138
00139 float64_t svm_predict(const struct svm_model *model, const struct svm_node *x);
00140
00141 void svm_destroy_model(struct svm_model *model);
00142
00143 const char *svm_check_parameter(const struct svm_problem *prob, const struct svm_parameter *param);
00144 #endif
00145
00146 #endif // DOXYGEN_SHOULD_SKIP_THIS