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 #ifndef _LIBSVM_H
00035 #define _LIBSVM_H
00036
00037 #define LIBSVM_VERSION 286
00038
00039 namespace celeste
00040 {
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044
00045 struct svm_node
00046 {
00047 int index;
00048 double value;
00049 };
00050
00051 struct svm_problem
00052 {
00053 int l;
00054 double *y;
00055 struct svm_node **x;
00056 };
00057
00058 enum { C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR };
00059 enum { LINEAR, POLY, RBF, SIGMOID, PRECOMPUTED };
00060
00061 struct svm_parameter
00062 {
00063 int svm_type;
00064 int kernel_type;
00065 int degree;
00066 double gamma;
00067 double coef0;
00068
00069
00070 double cache_size;
00071 double eps;
00072 double C;
00073 int nr_weight;
00074 int *weight_label;
00075 double* weight;
00076 double nu;
00077 double p;
00078 int shrinking;
00079 int probability;
00080 };
00081
00082 struct svm_model *svm_train(const struct svm_problem *prob, const struct svm_parameter *param);
00083 void svm_cross_validation(const struct svm_problem *prob, const struct svm_parameter *param, int nr_fold, double *target);
00084
00085 int svm_save_model(const char *model_file_name, const struct svm_model *model);
00086 struct svm_model *svm_load_model(const char *model_file_name);
00087
00088 int svm_get_svm_type(const struct svm_model *model);
00089 int svm_get_nr_class(const struct svm_model *model);
00090 void svm_get_labels(const struct svm_model *model, int *label);
00091 double svm_get_svr_probability(const struct svm_model *model);
00092
00093 void svm_predict_values(const struct svm_model *model, const struct svm_node *x, double* dec_values);
00094 double svm_predict(const struct svm_model *model, const struct svm_node *x);
00095 double svm_predict_probability(const struct svm_model *model, const struct svm_node *x, double* prob_estimates);
00096
00097 void svm_destroy_model(struct svm_model *model);
00098 void svm_destroy_param(struct svm_parameter *param);
00099
00100 const char *svm_check_parameter(const struct svm_problem *prob, const struct svm_parameter *param);
00101 int svm_check_probability_model(const struct svm_model *model);
00102
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106 };
00107 #endif