![]() |
KSquare Utilities
|
Namespace used to wrap implementation of libSVM version 2.89 to be used as a pair-wise SVM. More...
Classes | |
| class | Cache |
| struct | decision_function |
| class | Kernel |
| class | ONE_CLASS_Q |
| class | QMatrix |
| class | Solver |
| class | Solver_NU |
| class | SVC_Q |
| struct | svm_model |
| struct | svm_parameter |
| struct | svm_problem |
| class | SVR_Q |
Typedefs | |
| typedef float | Qfloat |
| typedef signed char | schar |
Enumerations | |
| enum | Kernel_Type { Kernel_NULL, LINEAR, POLY, RBF, SIGMOID, PRECOMPUTED } |
| enum | SVM_Type { SVM_Type::SVM_NULL, SVM_Type::C_SVC, SVM_Type::NU_SVC, SVM_Type::ONE_CLASS, SVM_Type::EPSILON_SVR, SVM_Type::NU_SVR } |
Functions | |
| template<class S , class T > | |
| void | clone (T *&dst, S *src, kkint32 n) |
| template<class T > | |
| T * | GrowAllocation (T *src, kkint32 origSize, kkint32 newSize) |
| Kernel_Type | Kernel_Type_FromStr (KKStr s) |
| KKStr | Kernel_Type_ToStr (Kernel_Type kernelType) |
| void | multiclass_probability (kkint32 k, double **r, double *p) |
| double | powi (double base, kkint32 times) |
| double | sigmoid_predict (double decision_value, double A, double B) |
| void | sigmoid_train (kkint32 l, const double *dec_values, const double *labels, double &A, double &B) |
| void | solve_c_svc (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si, double Cp, double Cn, RunLog &_log) |
| void | solve_epsilon_svr (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si, RunLog &_log) |
| void | solve_nu_svc (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si, RunLog &_log) |
| void | solve_one_class (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si, RunLog &_log) |
| const char * | svm_check_parameter (const struct svm_problem *prob, const struct svm_parameter *param) |
| kkint32 | svm_check_probability_model (const struct svm_model *model) |
| void | svm_cross_validation (const svm_problem &prob, const svm_parameter ¶m, kkint32 nr_fold, double *target, RunLog &log) |
| void | svm_destroy_model (struct svm_model *&model) |
| void | svm_destroy_param (struct svm_parameter *¶m) |
| void | svm_get_labels (const svm_model *model, kkint32 *label) |
| kkint32 | svm_get_nr_class (const svm_model *model) |
| SVM_Type | svm_get_svm_type (const svm_model *model) |
| double | svm_get_svr_probability (const svm_model *model) |
| double | svm_predict (const struct svm_model *model, const FeatureVector &x) |
| double | svm_predict_probability (svm_model *model, const FeatureVector &x, double *prob_estimates, kkint32 *votes) |
| void | svm_predict_values (const svm_model *model, const FeatureVector &x, double *dec_values) |
| svm_model * | svm_train (const svm_problem &prob, const svm_parameter ¶m, RunLog &log) |
| decision_function | svm_train_one (const svm_problem &prob, const svm_parameter ¶m, double Cp, double Cn, RunLog &_log) |
| SVM_Type | SVM_Type_FromStr (KKStr s) |
| KKStr | SVM_Type_ToStr (SVM_Type svmType) |
| template<class T > | |
| void | swap (T &x, T &y) |
Variables | |
| kkint32 | libsvm_version |
| void(* | svm_print_string )(const char *) = &print_string_stdout |
Namespace used to wrap implementation of libSVM version 2.89 to be used as a pair-wise SVM.
There is more than one version of libSVM implemented in the library. To prevent name conflicts between them each one was wrapped in their own namespace.
libSVM is a Support Vector Machine implemented done by "Chih-Chung Chang" and "Chih-Jen Lin". It was downloaded from http://www.csie.ntu.edu.tw/~cjlin/libsvm/. The source code was modified by Kurt Kramer. The primary changes to this implementation involves the replacement of the sparse data-structure in the original implementation with fixed length array implemented through the "FeatureVector" class and the ability to specify a sub-set of features to be utilized via the "FeatureNumList" class. This allows us to load in a single set of training data with all its features that can then be used for multiple Support Vector Machine instances where each instance utilizes a different set of features. This particular implementation SVM289_BFS was meant to work with the Binary-Feature-Selection (Pair-Wise) version of the support vector machine as described by "Increased classification accuracy and speedup through pair-wise feature selection for support vector machines."
| typedef float SVM289_BFS::Qfloat |
Definition at line 269 of file svm289_BFS.h.
| typedef signed char SVM289_BFS::schar |
Definition at line 271 of file svm289_BFS.h.
| Enumerator | |
|---|---|
| Kernel_NULL | |
| LINEAR | |
| POLY | |
| RBF | |
| SIGMOID | |
| PRECOMPUTED | |
Definition at line 77 of file svm289_BFS.h.
|
strong |
|
inline |
Definition at line 274 of file svm289_BFS.h.
|
inline |
Definition at line 78 of file svm289_BFS.cpp.
| Kernel_Type SVM289_BFS::Kernel_Type_FromStr | ( | KKStr | s | ) |
Definition at line 575 of file svm289_BFS.cpp.
References KKB::KKStr::EqualIgnoreCase(), Kernel_NULL, LINEAR, KKB::KKStr::operator==(), POLY, PRECOMPUTED, RBF, SIGMOID, and KKB::KKStr::Upper().
Referenced by SVM289_BFS::svm_parameter::ParseTabDelStr(), and SVM289_BFS::svm_parameter::ProcessSvmParameter().
| KKStr SVM289_BFS::Kernel_Type_ToStr | ( | Kernel_Type | kernelType | ) |
Definition at line 600 of file svm289_BFS.cpp.
References LINEAR, POLY, PRECOMPUTED, RBF, and SIGMOID.
Referenced by SVM289_BFS::svm_parameter::ToTabDelStr().
| void SVM289_BFS::multiclass_probability | ( | kkint32 | k, |
| double ** | r, | ||
| double * | p | ||
| ) |
| k | Number of Classes. |
| r | Pairwise Probabilities. |
| p | Class Probability |
Definition at line 3051 of file svm289_BFS.cpp.
References info().
|
inline |
| double SVM289_BFS::sigmoid_predict | ( | double | decision_value, |
| double | A, | ||
| double | B | ||
| ) |
Definition at line 3034 of file svm289_BFS.cpp.
| void SVM289_BFS::sigmoid_train | ( | kkint32 | l, |
| const double * | dec_values, | ||
| const double * | labels, | ||
| double & | A, | ||
| double & | B | ||
| ) |
Definition at line 2899 of file svm289_BFS.cpp.
References info().
Referenced by svm_binary_svc_probability().
| void SVM289_BFS::solve_c_svc | ( | const svm_problem * | prob, |
| const svm_parameter * | param, | ||
| double * | alpha, | ||
| Solver::SolutionInfo * | si, | ||
| double | Cp, | ||
| double | Cn, | ||
| RunLog & | _log | ||
| ) |
Definition at line 2451 of file svm289_BFS.cpp.
References SVM289_BFS::svm_parameter::eps, SVM289_BFS::svm_problem::l, SVM289_BFS::svm_parameter::shrinking, SVM289_BFS::Solver::Solve(), SVM289_BFS::SVC_Q::SVC_Q(), and SVM289_BFS::svm_problem::y.
Referenced by svm_train_one().
| void SVM289_BFS::solve_epsilon_svr | ( | const svm_problem * | prob, |
| const svm_parameter * | param, | ||
| double * | alpha, | ||
| Solver::SolutionInfo * | si, | ||
| RunLog & | _log | ||
| ) |
Definition at line 2650 of file svm289_BFS.cpp.
References SVM289_BFS::svm_parameter::C, SVM289_BFS::svm_parameter::eps, info(), SVM289_BFS::svm_problem::l, SVM289_BFS::svm_parameter::p, SVM289_BFS::svm_parameter::shrinking, SVM289_BFS::Solver::Solve(), SVM289_BFS::SVR_Q::SVR_Q(), and SVM289_BFS::svm_problem::y.
Referenced by svm_train_one().
| void SVM289_BFS::solve_nu_svc | ( | const svm_problem * | prob, |
| const svm_parameter * | param, | ||
| double * | alpha, | ||
| Solver::SolutionInfo * | si, | ||
| RunLog & | _log | ||
| ) |
Definition at line 2513 of file svm289_BFS.cpp.
References SVM289_BFS::svm_parameter::eps, info(), SVM289_BFS::svm_problem::l, SVM289_BFS::svm_parameter::nu, SVM289_BFS::Solver::SolutionInfo::obj, SVM289_BFS::Solver::SolutionInfo::r, SVM289_BFS::Solver::SolutionInfo::rho, SVM289_BFS::svm_parameter::shrinking, SVM289_BFS::Solver_NU::Solve(), SVM289_BFS::SVC_Q::SVC_Q(), SVM289_BFS::Solver::SolutionInfo::upper_bound_n, SVM289_BFS::Solver::SolutionInfo::upper_bound_p, and SVM289_BFS::svm_problem::y.
Referenced by svm_train_one().
| void SVM289_BFS::solve_one_class | ( | const svm_problem * | prob, |
| const svm_parameter * | param, | ||
| double * | alpha, | ||
| Solver::SolutionInfo * | si, | ||
| RunLog & | _log | ||
| ) |
Definition at line 2595 of file svm289_BFS.cpp.
References SVM289_BFS::svm_parameter::eps, SVM289_BFS::svm_problem::l, SVM289_BFS::svm_parameter::nu, SVM289_BFS::ONE_CLASS_Q::ONE_CLASS_Q(), SVM289_BFS::svm_parameter::shrinking, and SVM289_BFS::Solver::Solve().
Referenced by svm_train_one().
| const char* SVM289_BFS::svm_check_parameter | ( | const struct svm_problem * | prob, |
| const struct svm_parameter * | param | ||
| ) |
| void SVM289_BFS::svm_cross_validation | ( | const svm_problem & | prob, |
| const svm_parameter & | param, | ||
| kkint32 | nr_fold, | ||
| double * | target, | ||
| RunLog & | log | ||
| ) |
Definition at line 3701 of file svm289_BFS.cpp.
References C_SVC, SVM289_BFS::svm_problem::FileDesc(), SVM289_BFS::svm_problem::l, NU_SVC, SVM289_BFS::svm_parameter::probability, SVM289_BFS::svm_problem::SelFeatures(), svm_destroy_model(), svm_get_nr_class(), svm_group_classes(), SVM289_BFS::svm_problem::svm_problem(), svm_train(), SVM289_BFS::svm_parameter::svm_type, and SVM289_BFS::svm_problem::y.
Referenced by svm_svr_probability().
| void SVM289_BFS::svm_destroy_model | ( | struct svm_model *& | model | ) |
| void SVM289_BFS::svm_destroy_param | ( | struct svm_parameter *& | param | ) |
Definition at line 4664 of file svm289_BFS.cpp.
Definition at line 3869 of file svm289_BFS.cpp.
References SVM289_BFS::svm_model::label, and SVM289_BFS::svm_model::nr_class.
Definition at line 3861 of file svm289_BFS.cpp.
References SVM289_BFS::svm_model::nr_class.
Referenced by svm_cross_validation().
Definition at line 3854 of file svm289_BFS.cpp.
References SVM289_BFS::svm_model::param, and SVM289_BFS::svm_parameter::svm_type.
| double SVM289_BFS::svm_get_svr_probability | ( | const svm_model * | model | ) |
Definition at line 3880 of file svm289_BFS.cpp.
References EPSILON_SVR, NU_SVR, SVM289_BFS::svm_model::param, SVM289_BFS::svm_model::probA, and SVM289_BFS::svm_parameter::svm_type.
| double SVM289_BFS::svm_predict | ( | const struct svm_model * | model, |
| const FeatureVector & | x | ||
| ) |
Referenced by svm_predict_probability().
| double SVM289_BFS::svm_predict_probability | ( | svm_model * | model, |
| const FeatureVector & | x, | ||
| double * | prob_estimates, | ||
| kkint32 * | votes | ||
| ) |
Definition at line 4027 of file svm289_BFS.cpp.
References C_SVC, SVM289_BFS::svm_model::DecValues(), SVM289_BFS::svm_model::label, SVM289_BFS::svm_model::NormalizeProbability(), SVM289_BFS::svm_model::nr_class, NU_SVC, SVM289_BFS::svm_model::PairwiseProb(), SVM289_BFS::svm_model::param, SVM289_BFS::svm_model::probA, SVM289_BFS::svm_model::probB, SVM289_BFS::svm_model::ProbEstimates(), SVM289_BFS::svm_parameter::probParam, svm_predict(), svm_predict_values(), and SVM289_BFS::svm_parameter::svm_type.
| void SVM289_BFS::svm_predict_values | ( | const svm_model * | model, |
| const FeatureVector & | x, | ||
| double * | dec_values | ||
| ) |
Definition at line 3895 of file svm289_BFS.cpp.
References EPSILON_SVR, SVM289_BFS::svm_model::l, SVM289_BFS::svm_model::nr_class, SVM289_BFS::svm_model::nSV, NU_SVR, ONE_CLASS, SVM289_BFS::svm_model::param, SVM289_BFS::svm_model::rho, SVM289_BFS::svm_model::sv_coef, and SVM289_BFS::svm_parameter::svm_type.
Referenced by svm_predict_probability().
| svm_model * SVM289_BFS::svm_train | ( | const svm_problem & | prob, |
| const svm_parameter & | param, | ||
| RunLog & | log | ||
| ) |
Definition at line 3385 of file svm289_BFS.cpp.
References SVM289_BFS::decision_function::alpha, SVM289_BFS::svm_parameter::C, EPSILON_SVR, KKMLL::FeatureVectorList::FeatureVectorList(), SVM289_BFS::svm_problem::FileDesc(), info(), SVM289_BFS::svm_problem::l, SVM289_BFS::svm_model::l, SVM289_BFS::svm_model::label, SVM289_BFS::svm_model::nr_class, SVM289_BFS::svm_parameter::nr_weight, SVM289_BFS::svm_model::nSV, NU_SVR, ONE_CLASS, SVM289_BFS::svm_model::probA, SVM289_BFS::svm_parameter::probability, SVM289_BFS::svm_model::probB, SVM289_BFS::svm_model::rho, SVM289_BFS::decision_function::rho, SVM289_BFS::svm_problem::SelFeatures(), SVM289_BFS::svm_model::sv_coef, svm_binary_svc_probability(), svm_group_classes(), SVM289_BFS::svm_model::svm_model(), SVM289_BFS::svm_problem::svm_problem(), svm_svr_probability(), svm_train_one(), SVM289_BFS::svm_parameter::svm_type, SVM289_BFS::svm_parameter::weight, SVM289_BFS::svm_parameter::weight_label, SVM289_BFS::svm_model::weOwnSupportVectors, and SVM289_BFS::svm_problem::y.
Referenced by svm_binary_svc_probability(), and svm_cross_validation().
| decision_function SVM289_BFS::svm_train_one | ( | const svm_problem & | prob, |
| const svm_parameter & | param, | ||
| double | Cp, | ||
| double | Cn, | ||
| RunLog & | _log | ||
| ) |
Definition at line 2781 of file svm289_BFS.cpp.
References SVM289_BFS::decision_function::alpha, C_SVC, KKB::KKStr::Concat(), EPSILON_SVR, KKB::KKException::KKException(), SVM289_BFS::svm_problem::l, NU_SVC, NU_SVR, ONE_CLASS, SVM289_BFS::Solver::SolutionInfo::rho, SVM289_BFS::decision_function::rho, solve_c_svc(), solve_epsilon_svr(), solve_nu_svc(), solve_nu_svr(), solve_one_class(), SVM289_BFS::svm_parameter::svm_type, and SVM289_BFS::svm_problem::y.
Referenced by svm_train().
Definition at line 536 of file svm289_BFS.cpp.
References C_SVC, EPSILON_SVR, KKB::KKStr::EqualIgnoreCase(), NU_SVC, NU_SVR, ONE_CLASS, KKB::KKStr::operator==(), SVM_NULL, and KKB::KKStr::Upper().
Referenced by SVM289_BFS::svm_parameter::ParseTabDelStr(), and SVM289_BFS::svm_parameter::ProcessSvmParameter().
Definition at line 560 of file svm289_BFS.cpp.
References C_SVC, EPSILON_SVR, NU_SVC, NU_SVR, and ONE_CLASS.
Referenced by SVM289_BFS::svm_parameter::ToTabDelStr().
|
inline |
Definition at line 265 of file svm289_BFS.h.
| kkint32 SVM289_BFS::libsvm_version |
| void(* SVM289_BFS::svm_print_string)(const char *) = &print_string_stdout |
Definition at line 624 of file svm289_BFS.cpp.