Changeset 45

Ignore:
Timestamp:
Feb 27, 2004, 3:20:41 PM (18 years ago)
Message:

Choose is made as a function

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
 r42 // $Id$ #ifndef CS_CPP_TOOLS_SVM_H #define CS_CPP_TOOLS_SVM_H #ifndef _THEP_SVM_H #define _THEP_SVM_H // C++ tools include // Standard C++ includes //////////////////////// #include namespace theplu { namespace cpptools { /// /// Class for SVM using a modified version of the SMO algorithm /// (Cristianini). The difference to the original SMO is that the /// whole Kernel matrix is kept in memory instead of calculating each /// element when it's needed. If the number of samples (size of /// kernel matrix) is too large, the original SMO should be used /// instead (or buying more memory!). In the present implementation /// only maximal margin SVMs can be used and any kind of validation /// or testing is not possible. /// class SVM { public: /** Constructor taking the kernel matrix and the target vector as input */ /// /// Constructor taking the kernel matrix and the target vector as input /// SVM(const gslapi::matrix&, const gslapi::vector&); /** Training the SVM using the SMO algorithm */ /// /// Training the SVM using the SMO algorithm /// void train(); /** Function will return \f$\alpha\f$ */ /// /// Function will return \f$\alpha\f$ /// inline gslapi::vector get_alpha() const; /** Function will return the output from SVM */ /// /// Function will return the output from SVM /// inline gslapi::vector get_output() const; double bias_; /** Private function that determines when to stop the training. The test is done in two steps. First, we check that the functional margin is at least 2 - epsilon. Second, we check that the gap between the primal and the dual object is less than epsilon. */ bool SVM::stop(const gslapi::vector& target_, const gslapi::matrix& kernel_, const gslapi::vector& alpha_); /// ///   Private function choosing which two elements that should be ///   updated. By random from uniform distributions. /// std::pair choose(u_int nof_samples); /// /// Private function that determines when to stop the training. /// The test is done in two steps. First, we check that the /// functional margin is at least 2 - epsilon. Second, we check /// that the gap between the primal and the dual object is less /// than epsilon. /// bool stop(const gslapi::vector& target_, const gslapi::matrix& kernel_, const gslapi::vector& alpha_); };