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