4 #define LIBSVM_VERSION 291
10 extern int libsvm_version;
25 enum { C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR }; /* svm_type */
26 enum { LINEAR, POLY, RBF, SIGMOID, PRECOMPUTED }; /* kernel_type */
32 int degree; /* for poly */
33 double gamma; /* for poly/rbf/sigmoid */
34 double coef0; /* for poly/sigmoid */
36 /* these are for training only */
37 double cache_size; /* in MB */
38 double eps; /* stopping criteria */
39 double C; /* for C_SVC, EPSILON_SVR and NU_SVR */
40 int nr_weight; /* for C_SVC */
41 int *weight_label; /* for C_SVC */
42 double* weight; /* for C_SVC */
43 double nu; /* for NU_SVC, ONE_CLASS, and NU_SVR */
44 double p; /* for EPSILON_SVR */
45 int shrinking; /* use the shrinking heuristics */
46 int probability; /* do probability estimates */
49 struct svm_model *svm_train(const struct svm_problem *prob, const struct svm_parameter *param);
50 void svm_cross_validation(const struct svm_problem *prob, const struct svm_parameter *param, int nr_fold, double *target);
52 int svm_save_model(const char *model_file_name, const struct svm_model *model);
53 struct svm_model *svm_load_model(const char *model_file_name);
55 int svm_get_svm_type(const struct svm_model *model);
56 int svm_get_nr_class(const struct svm_model *model);
57 void svm_get_labels(const struct svm_model *model, int *label);
58 double svm_get_svr_probability(const struct svm_model *model);
60 double svm_predict_values(const struct svm_model *model, const struct svm_node *x, double* dec_values);
61 double svm_predict(const struct svm_model *model, const struct svm_node *x);
62 double svm_predict_probability(const struct svm_model *model, const struct svm_node *x, double* prob_estimates);
64 void svm_destroy_model(struct svm_model *model);
65 void svm_destroy_param(struct svm_parameter *param);
67 const char *svm_check_parameter(const struct svm_problem *prob, const struct svm_parameter *param);
68 int svm_check_probability_model(const struct svm_model *model);
70 void svm_set_print_string_function(void (*print_func)(const char *));
76 #endif /* _LIBSVM_H */