svm.h
Go to the documentation of this file.
00001 #ifndef _LIBSVM_H
00002 #define _LIBSVM_H
00003 
00004 #define LIBSVM_VERSION 286
00005 
00006 #ifdef __cplusplus
00007 extern "C" {
00008 #endif
00009 
00010 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
00011 #  define XPRT __declspec(dllexport)
00012 #else
00013 #  define XPRT
00014 #endif
00015 
00016 struct svm_node
00017 {
00018         int index;
00019         double value;
00020 };
00021 
00022 struct svm_problem
00023 {
00024         int l;
00025         double *y;
00026         struct svm_node **x;
00027 };
00028 
00029 enum { C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR }; /* svm_type */
00030 enum { LINEAR, POLY, RBF, SIGMOID, PRECOMPUTED }; /* kernel_type */
00031 
00032 struct svm_parameter
00033 {
00034         int svm_type;
00035         int kernel_type;
00036         int degree;     /* for poly */
00037         double gamma;   /* for poly/rbf/sigmoid */
00038         double coef0;   /* for poly/sigmoid */
00039 
00040         /* these are for training only */
00041         double cache_size; /* in MB */
00042         double eps;     /* stopping criteria */
00043         double C;       /* for C_SVC, EPSILON_SVR and NU_SVR */
00044         int nr_weight;          /* for C_SVC */
00045         int *weight_label;      /* for C_SVC */
00046         double* weight;         /* for C_SVC */
00047         double nu;      /* for NU_SVC, ONE_CLASS, and NU_SVR */
00048         double p;       /* for EPSILON_SVR */
00049         int shrinking;  /* use the shrinking heuristics */
00050         int probability; /* do probability estimates */
00051 };
00052 
00053 XPRT
00054 struct svm_model *svm_train(const struct svm_problem *prob, const struct svm_parameter *param);
00055 XPRT
00056 void svm_cross_validation(const struct svm_problem *prob, const struct svm_parameter *param, int nr_fold, double *target);
00057 
00058 XPRT
00059 int svm_save_model(const char *model_file_name, const struct svm_model *model);
00060 XPRT
00061 struct svm_model *svm_load_model(const char *model_file_name);
00062 
00063 XPRT
00064 int svm_get_svm_type(const struct svm_model *model);
00065 XPRT
00066 int svm_get_nr_class(const struct svm_model *model);
00067 XPRT
00068 void svm_get_labels(const struct svm_model *model, int *label);
00069 XPRT
00070 double svm_get_svr_probability(const struct svm_model *model);
00071 
00072 XPRT
00073 void svm_predict_values(const struct svm_model *model, const struct svm_node *x, double* dec_values);
00074 XPRT
00075 double svm_predict(const struct svm_model *model, const struct svm_node *x);
00076 XPRT
00077 double svm_predict_probability(const struct svm_model *model, const struct svm_node *x, double* prob_estimates);
00078 
00079 XPRT
00080 void svm_destroy_model(struct svm_model *model);
00081 XPRT
00082 void svm_destroy_param(struct svm_parameter *param);
00083 
00084 XPRT
00085 const char *svm_check_parameter(const struct svm_problem *prob, const struct svm_parameter *param);
00086 XPRT
00087 int svm_check_probability_model(const struct svm_model *model);
00088 
00089 #ifdef __cplusplus
00090 }
00091 #endif
00092 
00093 #endif /* _LIBSVM_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


cl_libsvm
Author(s): Gabor Melis
autogenerated on Sun Oct 6 2013 12:19:01