Builds clsfy_rbf_parzen classifiers. More...
#include <clsfy_parzen_builder.h>
Public Member Functions | |
clsfy_parzen_builder () | |
virtual clsfy_classifier_base * | new_classifier () const |
Create empty model. | |
virtual double | build (clsfy_classifier_base &model, mbl_data_wrapper< vnl_vector< double > > &inputs, unsigned nClasses, const vcl_vector< unsigned > &outputs) const |
Build classifier from data. | |
virtual vcl_string | is_a () const |
Name of the class. | |
virtual bool | is_class (vcl_string const &s) const |
Name of the class. | |
short | version_no () const |
IO Version number. | |
virtual clsfy_builder_base * | clone () const |
Create a copy on the heap and return base class pointer. | |
virtual void | print_summary (vcl_ostream &os) const |
Print class to os. | |
virtual void | b_write (vsl_b_ostream &bfs) const |
Save class to binary file stream. | |
virtual void | b_read (vsl_b_istream &bfs) |
Load class from binary file stream. | |
double | rbf_width () const |
The 1st standard deviation width of the RBF window. | |
void | set_rbf_width (double sigma) |
Set the 1st standard deviation width of the RBF window. | |
double | power () const |
The value p in the window function $exp(-1/(2*sigma^p) * |x-y|^p)$. | |
void | set_power (double p) |
The value p in the window function $exp(-1/(2*sigma^p) * |x-y|^p)$. | |
void | config (vcl_istream &as) |
Initialise the parameters from a text 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 | sigma_ |
The width of the RBF window function. Default value is 1.0. | |
double | power_ |
The power, p, in the window function. Default value is 2.0. |
Builds clsfy_rbf_parzen classifiers.
This class doesn't do any calculation, it is easy to create a Parzen window classifier directly - but it allows for consistent swappable classifiers.
Definition at line 26 of file clsfy_parzen_builder.h.
clsfy_parzen_builder::clsfy_parzen_builder | ( | ) |
Definition at line 26 of file clsfy_parzen_builder.cxx.
void clsfy_parzen_builder::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Implements clsfy_builder_base.
Definition at line 78 of file clsfy_parzen_builder.cxx.
void clsfy_parzen_builder::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Implements clsfy_builder_base.
Definition at line 69 of file clsfy_parzen_builder.cxx.
double clsfy_parzen_builder::build | ( | clsfy_classifier_base & | model, |
mbl_data_wrapper< vnl_vector< double > > & | inputs, | ||
unsigned | nClasses, | ||
const vcl_vector< unsigned > & | outputs | ||
) | const [virtual] |
Build classifier from data.
Build model from data.
return the mean error over the training set.
return the mean error over the training set. For many classifiers, you may use nClasses==1 to indicate a binary classifier
Implements clsfy_builder_base.
Definition at line 103 of file clsfy_parzen_builder.cxx.
clsfy_builder_base * clsfy_parzen_builder::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Implements clsfy_builder_base.
Definition at line 55 of file clsfy_parzen_builder.cxx.
void clsfy_parzen_builder::config | ( | vcl_istream & | as | ) | [virtual] |
Initialise the parameters from a text stream.
The next non-ws character in the stream should be a '{'
{ sigma: 1.0 (optional, width of RBF) power: 2.0 (optional, exponent of RBF) }
mbl_exception_parse_error | if the parse fails. |
Reimplemented from clsfy_builder_base.
Definition at line 174 of file clsfy_parzen_builder.cxx.
vcl_string clsfy_parzen_builder::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_builder_base.
Definition at line 41 of file clsfy_parzen_builder.cxx.
bool clsfy_parzen_builder::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_builder_base.
Definition at line 48 of file clsfy_parzen_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_parzen_builder::new_classifier | ( | ) | const [virtual] |
Create empty model.
Create empty classifier.
Caller is responsible for deletion
Implements clsfy_builder_base.
Definition at line 158 of file clsfy_parzen_builder.cxx.
double clsfy_parzen_builder::power | ( | ) | const [inline] |
The value p in the window function $exp(-1/(2*sigma^p) * |x-y|^p)$.
The value p affects the kurtosis, or peakyness of the window. Towards 0 gives a more peaked central spike, and longer tail. Toward +inf gives a broader peak, and shorter tail. The default value is 2, giving a Gaussian distribution.
Definition at line 82 of file clsfy_parzen_builder.h.
void clsfy_parzen_builder::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Implements clsfy_builder_base.
Definition at line 62 of file clsfy_parzen_builder.cxx.
double clsfy_parzen_builder::rbf_width | ( | ) | const [inline] |
The 1st standard deviation width of the RBF window.
The default value is 1.
Definition at line 72 of file clsfy_parzen_builder.h.
void clsfy_parzen_builder::set_power | ( | double | p | ) |
The value p in the window function $exp(-1/(2*sigma^p) * |x-y|^p)$.
The value p affects the kurtosis, or peakyness of the window. Towards 0 gives a more peaked central spike, and longer tail. Toward +inf gives a broader peak, and shorter tail. The default value is 2, giving a Gaussian distribution.
Definition at line 148 of file clsfy_parzen_builder.cxx.
void clsfy_parzen_builder::set_rbf_width | ( | double | sigma | ) |
Set the 1st standard deviation width of the RBF window.
The default value is 1.
The default value is 1. Really this could be better named as the RBF radius.
Definition at line 135 of file clsfy_parzen_builder.cxx.
short clsfy_parzen_builder::version_no | ( | ) | const |
IO Version number.
Definition at line 34 of file clsfy_parzen_builder.cxx.
double clsfy_parzen_builder::power_ [private] |
The power, p, in the window function. Default value is 2.0.
Definition at line 32 of file clsfy_parzen_builder.h.
double clsfy_parzen_builder::sigma_ [private] |
The width of the RBF window function. Default value is 1.0.
Definition at line 29 of file clsfy_parzen_builder.h.