Base for classes to build clsfy_classifier_base objects. More...
#include <clsfy_adaboost_sorted_builder.h>
Public Member Functions | |
clsfy_adaboost_sorted_builder () | |
virtual | ~clsfy_adaboost_sorted_builder () |
virtual clsfy_classifier_base * | new_classifier () const |
Create empty model. | |
void | set_batch_size (int bs) |
set batch size. | |
void | set_save_data_to_disk (bool x) |
set save data to disk bool. | |
void | set_max_n_clfrs (int max_n_clfrs) |
set max_n_clfrs. | |
void | set_weak_builder (clsfy_builder_1d &weak_builder) |
set weak builder ( a pointer is retained ). | |
virtual double | build (clsfy_classifier_base &model, mbl_data_wrapper< vnl_vector< double > > &inputs, unsigned nClasses, const vcl_vector< unsigned > &outputs) const |
Build model 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. | |
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. | |
virtual 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 | |
bool | save_data_to_disk_ |
bool indicating whether or not to save data to disk. | |
int | bs_ |
batch size. | |
int | max_n_clfrs_ |
maximum number of classifiers found by Adaboost algorithm. | |
clsfy_builder_1d * | weak_builder_ |
pointer to 1d builder used to build each weak classifier. |
Base for classes to build clsfy_classifier_base objects.
Definition at line 26 of file clsfy_adaboost_sorted_builder.h.
clsfy_adaboost_sorted_builder::clsfy_adaboost_sorted_builder | ( | ) |
Definition at line 34 of file clsfy_adaboost_sorted_builder.cxx.
clsfy_adaboost_sorted_builder::~clsfy_adaboost_sorted_builder | ( | ) | [virtual] |
Definition at line 41 of file clsfy_adaboost_sorted_builder.cxx.
void clsfy_adaboost_sorted_builder::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Implements clsfy_builder_base.
Definition at line 447 of file clsfy_adaboost_sorted_builder.cxx.
void clsfy_adaboost_sorted_builder::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Implements clsfy_builder_base.
Definition at line 434 of file clsfy_adaboost_sorted_builder.cxx.
double clsfy_adaboost_sorted_builder::build | ( | clsfy_classifier_base & | model, |
mbl_data_wrapper< vnl_vector< double > > & | inputs, | ||
unsigned | nClasses, | ||
const vcl_vector< unsigned > & | outputs | ||
) | const [virtual] |
Build model from data.
Build classifier composed of 1d classifiers working on individual vector elements.
Return the mean error over the training set. For many classifiers, you may use nClasses==1 to indicate a binary classifier
Builds an n-component classifier, each component of which is a 1D classifier working on a single element of the input vector.
Implements clsfy_builder_base.
Definition at line 64 of file clsfy_adaboost_sorted_builder.cxx.
clsfy_builder_base * clsfy_adaboost_sorted_builder::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Implements clsfy_builder_base.
Definition at line 413 of file clsfy_adaboost_sorted_builder.cxx.
void clsfy_builder_base::config | ( | vcl_istream & | as | ) | [virtual, inherited] |
Initialise the parameters from a text stream.
Default case accepts no parameters.
Reimplemented in clsfy_rbf_svm_smo_1_builder, clsfy_parzen_builder, clsfy_knn_builder, clsfy_null_builder, and clsfy_binary_1d_wrapper_builder.
Definition at line 26 of file clsfy_builder_base.cxx.
vcl_string clsfy_adaboost_sorted_builder::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_builder_base.
Definition at line 55 of file clsfy_adaboost_sorted_builder.cxx.
bool clsfy_adaboost_sorted_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_adaboost_sorted_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_adaboost_sorted_builder::new_classifier | ( | ) | const [virtual] |
Create empty model.
Create empty classifier.
Caller is responsible for deletion
Implements clsfy_builder_base.
Definition at line 374 of file clsfy_adaboost_sorted_builder.cxx.
void clsfy_adaboost_sorted_builder::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Implements clsfy_builder_base.
Definition at line 421 of file clsfy_adaboost_sorted_builder.cxx.
void clsfy_adaboost_sorted_builder::set_batch_size | ( | int | bs | ) | [inline] |
set batch size.
Definition at line 57 of file clsfy_adaboost_sorted_builder.h.
void clsfy_adaboost_sorted_builder::set_max_n_clfrs | ( | int | max_n_clfrs | ) | [inline] |
set max_n_clfrs.
Definition at line 63 of file clsfy_adaboost_sorted_builder.h.
void clsfy_adaboost_sorted_builder::set_save_data_to_disk | ( | bool | x | ) | [inline] |
set save data to disk bool.
Definition at line 60 of file clsfy_adaboost_sorted_builder.h.
void clsfy_adaboost_sorted_builder::set_weak_builder | ( | clsfy_builder_1d & | weak_builder | ) | [inline] |
set weak builder ( a pointer is retained ).
Definition at line 66 of file clsfy_adaboost_sorted_builder.h.
int clsfy_adaboost_sorted_builder::bs_ [private] |
batch size.
i.e. number of training examples held in RAM whilst sorting takes place
Definition at line 37 of file clsfy_adaboost_sorted_builder.h.
int clsfy_adaboost_sorted_builder::max_n_clfrs_ [private] |
maximum number of classifiers found by Adaboost algorithm.
Definition at line 40 of file clsfy_adaboost_sorted_builder.h.
bool clsfy_adaboost_sorted_builder::save_data_to_disk_ [private] |
bool indicating whether or not to save data to disk.
NB useful to save data to disk, if don't have enough RAM but also makes training very slow
Definition at line 33 of file clsfy_adaboost_sorted_builder.h.
pointer to 1d builder used to build each weak classifier.
Definition at line 43 of file clsfy_adaboost_sorted_builder.h.