Base for classes to build clsfy_classifier_base objects. More...
#include <clsfy_rbf_svm_smo_1_builder.h>
Public Member Functions | |
clsfy_rbf_svm_smo_1_builder () | |
Dflt ctor. | |
clsfy_classifier_base * | new_classifier () const |
Create empty model. | |
double | build (clsfy_classifier_base &classifier, mbl_data_wrapper< vnl_vector< double > > &inputs, unsigned nClasses, const vcl_vector< unsigned > &outputs) const |
Build model from data. | |
double | build (clsfy_classifier_base &classifier, mbl_data_wrapper< vnl_vector< double > > &inputs, const vcl_vector< unsigned > &outputs) const |
Build a classifier from data. | |
double | rbf_width () const |
Radius of Gaussian function. | |
void | set_rbf_width (double) |
Set the Radius of Gaussian function. | |
void | set_bound_on_multipliers (double C) |
Set C, the upper bound on the Lagrange multipliers. | |
double | bound_on_multipliers () const |
The upper bound on the Lagrange multipliers. | |
vcl_string | is_a () const |
Name of the class. | |
bool | is_class (vcl_string const &s) const |
Name of the class. | |
short | version_no () const |
Return the class's IO version number. | |
clsfy_builder_base * | clone () const |
Create a copy on the heap and return base class pointer. | |
void | print_summary (vcl_ostream &os) const |
Print class to os. | |
void | b_write (vsl_b_ostream &bfs) const |
Save class to binary file stream. | |
void | b_read (vsl_b_istream &bfs) |
Load class from binary file stream. | |
void | config (vcl_istream &) |
Config from a stream. | |
Static Public Member Functions | |
static vcl_auto_ptr < clsfy_builder_base > | new_builder (vcl_istream &as) |
Load description from a text stream. | |
Private Attributes | |
double | boundC_ |
C, the upper bound on the Lagrange multipliers. | |
double | rbf_width_ |
Width of Gaussian function. |
Base for classes to build clsfy_classifier_base objects.
Definition at line 18 of file clsfy_rbf_svm_smo_1_builder.h.
clsfy_rbf_svm_smo_1_builder::clsfy_rbf_svm_smo_1_builder | ( | ) | [inline] |
Dflt ctor.
Definition at line 30 of file clsfy_rbf_svm_smo_1_builder.h.
void clsfy_rbf_svm_smo_1_builder::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Implements clsfy_builder_base.
Definition at line 153 of file clsfy_rbf_svm_smo_1_builder.cxx.
void clsfy_rbf_svm_smo_1_builder::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Implements clsfy_builder_base.
Definition at line 144 of file clsfy_rbf_svm_smo_1_builder.cxx.
double clsfy_rbf_svm_smo_1_builder::bound_on_multipliers | ( | ) | const [inline] |
The upper bound on the Lagrange multipliers.
0 means no (or infinite) upper bound. A finite value effectively allows the training data to encroach into the separating margin. Smaller C -> smoother boundary
Definition at line 68 of file clsfy_rbf_svm_smo_1_builder.h.
double clsfy_rbf_svm_smo_1_builder::build | ( | clsfy_classifier_base & | classifier, |
mbl_data_wrapper< vnl_vector< double > > & | inputs, | ||
unsigned | nClasses, | ||
const vcl_vector< unsigned > & | outputs | ||
) | const [virtual] |
Build model from data.
Build classifier from data.
returns the empirical error, or +INF if there is an error. nclasses should be 1. The members of outputs() should be 0 or 1.
returns the training error, or +INF if there is an error. nClasses must be 1.
Implements clsfy_builder_base.
Definition at line 84 of file clsfy_rbf_svm_smo_1_builder.cxx.
double clsfy_rbf_svm_smo_1_builder::build | ( | clsfy_classifier_base & | classifier, |
mbl_data_wrapper< vnl_vector< double > > & | inputs, | ||
const vcl_vector< unsigned > & | outputs | ||
) | const |
Build a classifier from data.
Build classifier from data.
returns the empirical error rate, or +INF if there is an error. The members of outputs() should be 0 or 1.
returns the training error, or +INF if there is an error.
Definition at line 32 of file clsfy_rbf_svm_smo_1_builder.cxx.
clsfy_builder_base * clsfy_rbf_svm_smo_1_builder::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Implements clsfy_builder_base.
Definition at line 129 of file clsfy_rbf_svm_smo_1_builder.cxx.
void clsfy_rbf_svm_smo_1_builder::config | ( | vcl_istream & | as | ) | [virtual] |
Config from a stream.
Initialise the parameters from a text stream.
The next non-ws character in the stream should be a '{'
{ boundC: 3 (default 0 meaning no bound) Upper bound on the Lagrange multiplies. Smaller non-zero values result in a softening of the boundary. rbf_width: 3.0 (required) - A good guess is the mean euclidean distance to every examples nearest neighbour. }
mbl_exception_parse_error | if the parse fails. |
Reimplemented from clsfy_builder_base.
Definition at line 187 of file clsfy_rbf_svm_smo_1_builder.cxx.
vcl_string clsfy_rbf_svm_smo_1_builder::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_builder_base.
Definition at line 108 of file clsfy_rbf_svm_smo_1_builder.cxx.
bool clsfy_rbf_svm_smo_1_builder::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_builder_base.
Definition at line 115 of file clsfy_rbf_svm_smo_1_builder.cxx.
vcl_auto_ptr< clsfy_builder_base > clsfy_builder_base::new_builder | ( | vcl_istream & | as | ) | [static, inherited] |
Load description from a text stream.
The stream should contain the name of the feature extractor class that will be used, followed by a brace-enclosed list of parameters for the builder. This function will construct the appropriate clsfy_builder_base derivative and return that.
if | the parse fails. |
Definition at line 42 of file clsfy_builder_base.cxx.
clsfy_classifier_base* clsfy_rbf_svm_smo_1_builder::new_classifier | ( | ) | const [inline, virtual] |
Create empty model.
Implements clsfy_builder_base.
Definition at line 33 of file clsfy_rbf_svm_smo_1_builder.h.
void clsfy_rbf_svm_smo_1_builder::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Implements clsfy_builder_base.
Definition at line 136 of file clsfy_rbf_svm_smo_1_builder.cxx.
double clsfy_rbf_svm_smo_1_builder::rbf_width | ( | ) | const |
Radius of Gaussian function.
Definition at line 95 of file clsfy_rbf_svm_smo_1_builder.cxx.
void clsfy_rbf_svm_smo_1_builder::set_bound_on_multipliers | ( | double | C | ) | [inline] |
Set C, the upper bound on the Lagrange multipliers.
0 means no (or infinite) upper bound and is the default. A finite value effectively allows the training data to encroach into the separating margin. Smaller C -> smoother boundary
Definition at line 60 of file clsfy_rbf_svm_smo_1_builder.h.
void clsfy_rbf_svm_smo_1_builder::set_rbf_width | ( | double | rbf_width | ) |
Set the Radius of Gaussian function.
Definition at line 102 of file clsfy_rbf_svm_smo_1_builder.cxx.
short clsfy_rbf_svm_smo_1_builder::version_no | ( | ) | const |
Return the class's IO version number.
Definition at line 122 of file clsfy_rbf_svm_smo_1_builder.cxx.
double clsfy_rbf_svm_smo_1_builder::boundC_ [private] |
C, the upper bound on the Lagrange multipliers.
0 means no (or infinite) upper bound.
Definition at line 22 of file clsfy_rbf_svm_smo_1_builder.h.
double clsfy_rbf_svm_smo_1_builder::rbf_width_ [private] |
Width of Gaussian function.
Definition at line 25 of file clsfy_rbf_svm_smo_1_builder.h.