![]() |
KSquare Utilities
|
This is version 2.33 of "Chih-Chung Chang" and "Chih-Jen Lin" Support vector Machine; the class "ModelOldSVM" calls ths version. More...
Classes | |
| class | Cache |
| struct | decision_function |
| class | Kernel |
| Kernel evaluation. More... | |
| class | ONE_CLASS_Q |
| class | Solver |
| class | Solver_NU |
| class | SVC_Q |
| struct | svm_node |
| struct | svm_parameter |
| struct | svm_problem |
| struct | SvmModel233 |
| class | SVR_Q |
Typedefs | |
| typedef signed char | schar |
| typedef XmlElementTemplate< SvmModel233 > | XmlElementSvmModel233 |
| typedef XmlElementSvmModel233 * | XmlElementSvmModel233Ptr |
Enumerations | |
| enum | { C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR } |
| enum | { LINEAR, POLY, RBF, SIGMOID } |
Functions | |
| template<class S , class T > | |
| void | clone (T *&dst, S *src, kkint32 n) |
| void | info (const char *fmt,...) |
| void | info_flush () |
| template<class T > | |
| T | max (T x, T y) |
| template<class T > | |
| T | min (T x, T y) |
| static void | solve_c_svc (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si, double Cp, double Cn) |
| static void | solve_c_svc (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si, double *C_) |
| static void | solve_epsilon_svr (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si) |
| static void | solve_nu_svc (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si) |
| static void | solve_nu_svr (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si) |
| static void | solve_one_class (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si) |
| svm_problem * | svm_BuildProbFromTwoClassModel (const SvmModel233 *model, kkint32 excludeSupportVectorIDX) |
| const char * | svm_check_parameter (const struct svm_problem *prob, const struct svm_parameter *param) |
| void | svm_destroy_model (struct SvmModel233 *model) |
| void | svm_get_labels (const struct SvmModel233 *model, kkint32 *label) |
| kkint32 | svm_get_nr_class (const struct SvmModel233 *model) |
| void | svm_GetSupportVectorStatistics (const struct SvmModel233 *model, kkint32 &numSVs, kkint32 &totalNumSVs) |
| Extract Support Vector statistics . More... | |
| struct SvmModel233 * | Svm_Load_Model (std::istream &f, RunLog &log) |
| void | svm_margin (SvmModel233 *model) |
| double | svm_predict (const struct SvmModel233 *model, const struct svm_node *x) |
| double | svm_predict (const struct SvmModel233 *model, const svm_node *x, std::vector< double > &dist, std::vector< kkint32 > &winners, kkint32 excludeSupportVectorIDX) |
| Predicts a class for the specified training example. More... | |
| double | svm_predictTwoClasses (const SvmModel233 *model, const svm_node *x, double &dist, kkint32 excludeSupportVectorIDX) |
| void | Svm_Save_Model (std::ostream &o, const SvmModel233 *model) |
| struct SvmModel233 * | svm_train (const struct svm_problem *prob, const struct svm_parameter *param) |
| decision_function | svm_train_one (const svm_problem *prob, const svm_parameter *param) |
| decision_function | svm_train_one (const svm_problem *prob, const svm_parameter *param, double Cp, double Cn, std::set< kkint32 > &BSVIndex) |
| template<class T > | |
| void | Swap (T &x, T &y) |
| XmlFactoryMacro (SvmModel233) typedef float Qfloat | |
Variables | |
| const kkint32 | SCALE = 100 |
This is version 2.33 of "Chih-Chung Chang" and "Chih-Jen Lin" Support vector Machine; the class "ModelOldSVM" calls ths version.
This is a vesion 2.33 of "Chih-Chung Chang" and "Chih-Jen Lin" libSVM (Support Vector Machine); the class "ModelOldSVM" calls ths version.
libSVM is a Support Vector Machine implementation 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 Tong Luo and Kurt Kramer.
| typedef signed char SVM233::schar |
| anonymous enum |
| anonymous enum |
|
inline |
Definition at line 690 of file svm.cpp.
References svm_train_one().
| void SVM233::info | ( | const char * | fmt, |
| ... | |||
| ) |
Definition at line 715 of file svm.cpp.
Referenced by SVM233::Solver::Solve(), solve_c_svc(), solve_epsilon_svr(), solve_nu_svc(), solve_nu_svr(), and svm_train_one().
| void SVM233::info_flush | ( | ) |
|
inline |
|
inline |
|
static |
Definition at line 2811 of file svm.cpp.
References SVM233::svm_parameter::C, SVM233::svm_parameter::eps, info(), SVM233::svm_problem::l, SVM233::svm_parameter::shrinking, SVM233::Solver::Solve(), SVM233::SVC_Q::SVC_Q(), and SVM233::svm_problem::y.
Referenced by svm_train_one().
|
static |
Definition at line 2864 of file svm.cpp.
References SVM233::svm_parameter::C, SVM233::svm_parameter::eps, info(), SVM233::svm_problem::l, SVM233::svm_parameter::shrinking, SVM233::Solver::Solve(), SVM233::SVC_Q::SVC_Q(), and SVM233::svm_problem::y.
Referenced by svm_train_one().
|
static |
Definition at line 3008 of file svm.cpp.
References SVM233::svm_parameter::C, SVM233::svm_parameter::eps, info(), SVM233::svm_problem::l, SVM233::svm_parameter::p, SVM233::svm_parameter::shrinking, SVM233::Solver::Solve(), SVM233::SVR_Q::SVR_Q(), and SVM233::svm_problem::y.
Referenced by svm_train_one().
|
static |
Definition at line 2914 of file svm.cpp.
References SVM233::svm_parameter::eps, info(), SVM233::svm_problem::l, SVM233::svm_parameter::nu, SVM233::Solver::SolutionInfo::obj, SVM233::Solver::SolutionInfo::r, SVM233::Solver::SolutionInfo::rho, SVM233::svm_parameter::shrinking, SVM233::Solver_NU::Solve(), SVM233::SVC_Q::SVC_Q(), SVM233::Solver::SolutionInfo::upper_bound_n, SVM233::Solver::SolutionInfo::upper_bound_p, and SVM233::svm_problem::y.
Referenced by svm_train_one().
|
static |
Definition at line 3059 of file svm.cpp.
References SVM233::svm_parameter::C, SVM233::svm_parameter::eps, info(), SVM233::svm_problem::l, SVM233::svm_parameter::nu, SVM233::Solver::SolutionInfo::r, SVM233::svm_parameter::shrinking, SVM233::Solver_NU::Solve(), SVM233::SVR_Q::SVR_Q(), and SVM233::svm_problem::y.
Referenced by svm_train_one().
|
static |
Definition at line 2973 of file svm.cpp.
References SVM233::svm_parameter::eps, SVM233::svm_problem::l, SVM233::svm_parameter::nu, SVM233::ONE_CLASS_Q::ONE_CLASS_Q(), SVM233::svm_parameter::shrinking, and SVM233::Solver::Solve().
Referenced by svm_train_one().
| svm_problem * SVM233::svm_BuildProbFromTwoClassModel | ( | const SvmModel233 * | model, |
| kkint32 | excludeSupportVectorIDX | ||
| ) |
| excludeSupportVectorIDX | Specify index of a S/V to remove from computation. |
Definition at line 4356 of file svm.cpp.
References SVM233::SvmModel233::dim, EPSILON_SVR, SVM233::svm_node::index, SVM233::svm_problem::index, SVM233::svm_problem::l, SVM233::SvmModel233::l, SVM233::SvmModel233::nr_class, SVM233::SvmModel233::nSV, NU_SVR, ONE_CLASS, SVM233::SvmModel233::param, SVM233::SvmModel233::SV, SVM233::svm_problem::svm_problem(), SVM233::svm_parameter::svm_type, SVM233::svm_node::value, SVM233::svm_problem::weOwnContents, SVM233::svm_problem::x, and SVM233::svm_problem::y.
Referenced by KKMLL::SVMModel::FindWorstSupportVectors2().
| const char* SVM233::svm_check_parameter | ( | const struct svm_problem * | prob, |
| const struct svm_parameter * | param | ||
| ) |
| void SVM233::svm_destroy_model | ( | struct SvmModel233 * | model | ) |
Definition at line 4442 of file svm.cpp.
Referenced by KKMLL::SvmDestroyModel().
| void SVM233::svm_get_labels | ( | const struct SvmModel233 * | model, |
| kkint32 * | label | ||
| ) |
| kkint32 SVM233::svm_get_nr_class | ( | const struct SvmModel233 * | model | ) |
| void SVM233::svm_GetSupportVectorStatistics | ( | const struct SvmModel233 * | model, |
| kkint32 & | numSVs, | ||
| kkint32 & | totalNumSVs | ||
| ) |
Extract Support Vector statistics .
| [in] | model | Training Support Vector Machine. |
| [out] | numSVs | The number of training examples selected as Support Vectors. |
| [out] | totalNumSVs | Total number of SVs used by all the binary classifiers. |
Definition at line 4776 of file svm.cpp.
References KKB::KKStr::Concat(), EPSILON_SVR, KKB::KKException::KKException(), SVM233::SvmModel233::l, SVM233::SvmModel233::nr_class, SVM233::SvmModel233::nSV, NU_SVR, ONE_CLASS, SVM233::SvmModel233::param, SVM233::SvmModel233::sv_coef, and SVM233::svm_parameter::svm_type.
Referenced by KKMLL::SVMModel::SupportVectorStatistics().
| struct SvmModel233* SVM233::Svm_Load_Model | ( | std::istream & | f, |
| RunLog & | log | ||
| ) |
Referenced by KKMLL::SvmLoadModel().
| void SVM233::svm_margin | ( | SvmModel233 * | model | ) |
Definition at line 4650 of file svm.cpp.
References EPSILON_SVR, SVM233::Kernel::k_function(), SVM233::SvmModel233::margin, SVM233::SvmModel233::nr_class, SVM233::SvmModel233::nSV, NU_SVR, ONE_CLASS, SVM233::SvmModel233::param, SVM233::SvmModel233::SV, SVM233::SvmModel233::sv_coef, and SVM233::svm_parameter::svm_type.
| double SVM233::svm_predict | ( | const struct SvmModel233 * | model, |
| const struct svm_node * | x | ||
| ) |
| double SVM233::svm_predict | ( | const struct SvmModel233 * | model, |
| const svm_node * | x, | ||
| std::vector< double > & | dist, | ||
| std::vector< kkint32 > & | winners, | ||
| kkint32 | excludeSupportVectorIDX | ||
| ) |
Predicts a class for the specified training example.
| [in] | model | A previously trained model. |
| [in] | x | Example that we want to make prediction on. |
| [out] | dist | Entry for each class-pair indicating the distance from the decision boundary. |
| [out] | winners | A list of one or more classes that won the highest number of votes; that is for each pair of classes there is a vote and it is possible for there t be a tie for winner. |
| [in] | excludeSupportVectorIDX | Index of training example that should be excluded from computation; if less than zero will be ignored; this would be the same index specified when training the model to ignore. |
| double SVM233::svm_predictTwoClasses | ( | const SvmModel233 * | model, |
| const svm_node * | x, | ||
| double & | dist, | ||
| kkint32 | excludeSupportVectorIDX | ||
| ) |
| [in] | model | A previously trained model. |
| [in] | x | Example that we want to make prediction on. |
| [out] | dist | Distance from decision boundary. |
| [in] | excludeSupportVectorIDX | Index of support vector that should be excluded form computation; if less than zero will be ignored. |
Definition at line 4218 of file svm.cpp.
References SVM233::svm_parameter::dimSelect, EPSILON_SVR, SVM233::SvmModel233::featureWeight, SVM233::Kernel::k_function(), SVM233::Kernel::k_function_subspace(), SVM233::SvmModel233::kValueTable, SVM233::SvmModel233::l, SVM233::SvmModel233::label, SVM233::SvmModel233::nr_class, SVM233::SvmModel233::nSV, NU_SVR, ONE_CLASS, SVM233::SvmModel233::param, SVM233::SvmModel233::rho, SVM233::SvmModel233::SV, SVM233::SvmModel233::sv_coef, and SVM233::svm_parameter::svm_type.
Referenced by KKMLL::SVMModel::DistanceFromDecisionBoundary(), KKMLL::SVMModel::FindWorstSupportVectors(), KKMLL::SVMModel::FindWorstSupportVectors2(), and KKMLL::SvmPredictRaw().
| void SVM233::Svm_Save_Model | ( | std::ostream & | o, |
| const SvmModel233 * | model | ||
| ) |
Referenced by KKMLL::SvmSaveModel().
| struct SvmModel233* SVM233::svm_train | ( | const struct svm_problem * | prob, |
| const struct svm_parameter * | param | ||
| ) |
Referenced by KKMLL::SVMModel::FindWorstSupportVectors2(), and KKMLL::SvmTrainModel().
| decision_function SVM233::svm_train_one | ( | const svm_problem * | prob, |
| const svm_parameter * | param | ||
| ) |
Definition at line 3107 of file svm.cpp.
References SVM233::decision_function::alpha, C_SVC, info(), SVM233::svm_problem::l, SVM233::Solver::SolutionInfo::obj, SVM233::Solver::SolutionInfo::rho, SVM233::decision_function::rho, solve_c_svc(), SVM233::svm_parameter::svm_type, and SVM233::svm_problem::W.
| decision_function SVM233::svm_train_one | ( | const svm_problem * | prob, |
| const svm_parameter * | param, | ||
| double | Cp, | ||
| double | Cn, | ||
| std::set< kkint32 > & | BSVIndex | ||
| ) |
Definition at line 3154 of file svm.cpp.
References SVM233::decision_function::alpha, C_SVC, SVM233::svm_parameter::dimSelect, EPSILON_SVR, SVM233::svm_parameter::featureWeight, info(), SVM233::Kernel::k_function(), SVM233::Kernel::k_function_subspace(), SVM233::svm_problem::l, NU_SVC, NU_SVR, SVM233::Solver::SolutionInfo::obj, ONE_CLASS, SVM233::Solver::SolutionInfo::rho, SVM233::decision_function::rho, solve_c_svc(), solve_epsilon_svr(), solve_nu_svc(), solve_nu_svr(), solve_one_class(), SVM233::svm_parameter::svm_type, SVM233::svm_problem::x, and SVM233::svm_problem::y.
Referenced by clone(), max(), min(), and Swap().
|
inline |
| SVM233::XmlFactoryMacro | ( | SvmModel233 | ) |