Base for classes to build clsfy_classifier_1d objects. More...
#include <clsfy_binary_threshold_1d_builder.h>
Public Member Functions | |
clsfy_binary_threshold_1d_builder () | |
virtual | ~clsfy_binary_threshold_1d_builder () |
virtual clsfy_classifier_1d * | new_classifier () const |
Create empty model. | |
virtual double | build (clsfy_classifier_1d &classifier, const vnl_vector< double > &egs, const vnl_vector< double > &wts, const vcl_vector< unsigned > &outputs) const |
Build a binary_threshold classifier. | |
virtual double | build (clsfy_classifier_1d &classifier, vnl_vector< double > &egs0, vnl_vector< double > &wts0, vnl_vector< double > &egs1, vnl_vector< double > &wts1) const |
Build a binary_threshold classifier. | |
virtual double | build_from_sorted_data (clsfy_classifier_1d &classifier, const vbl_triple< double, int, int > *data, const vnl_vector< double > &wts) const |
Train classifier, returning weighted error. | |
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 |
Version number for I/O. | |
virtual clsfy_builder_1d * | 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_1d > | new_builder (vcl_istream &as) |
Load description from a text stream. |
Base for classes to build clsfy_classifier_1d objects.
Definition at line 18 of file clsfy_binary_threshold_1d_builder.h.
clsfy_binary_threshold_1d_builder::clsfy_binary_threshold_1d_builder | ( | ) |
Definition at line 19 of file clsfy_binary_threshold_1d_builder.cxx.
clsfy_binary_threshold_1d_builder::~clsfy_binary_threshold_1d_builder | ( | ) | [virtual] |
Definition at line 25 of file clsfy_binary_threshold_1d_builder.cxx.
void clsfy_binary_threshold_1d_builder::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Implements clsfy_builder_1d.
Reimplemented in clsfy_binary_threshold_1d_gini_builder.
Definition at line 238 of file clsfy_binary_threshold_1d_builder.cxx.
void clsfy_binary_threshold_1d_builder::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Implements clsfy_builder_1d.
Reimplemented in clsfy_binary_threshold_1d_gini_builder.
Definition at line 229 of file clsfy_binary_threshold_1d_builder.cxx.
double clsfy_binary_threshold_1d_builder::build | ( | clsfy_classifier_1d & | classifier, |
const vnl_vector< double > & | egs, | ||
const vnl_vector< double > & | wts, | ||
const vcl_vector< unsigned > & | outputs | ||
) | const [virtual] |
Build a binary_threshold classifier.
Train classifier, returning weighted error Selects parameters of classifier which best separate examples from two classes, weighting examples appropriately when estimating the misclassification rate. Returns weighted sum of error, e.wts, where e_i =0 for correct classifications, e_i=1 for incorrect.
Implements clsfy_builder_1d.
Definition at line 51 of file clsfy_binary_threshold_1d_builder.cxx.
double clsfy_binary_threshold_1d_builder::build | ( | clsfy_classifier_1d & | classifier, |
vnl_vector< double > & | egs0, | ||
vnl_vector< double > & | wts0, | ||
vnl_vector< double > & | egs1, | ||
vnl_vector< double > & | wts1 | ||
) | const [virtual] |
Build a binary_threshold classifier.
Train classifier, returning weighted error Selects parameters of classifier which best separate examples from two classes, weighting examples appropriately when estimating the misclassification rate. Returns weighted sum of error, e.wts, where e_i =0 for correct classifications, e_i=1 for incorrect.
nb here egs0 are -ve examples and egs1 are +ve examples
Implements clsfy_builder_1d.
Definition at line 85 of file clsfy_binary_threshold_1d_builder.cxx.
double clsfy_binary_threshold_1d_builder::build_from_sorted_data | ( | clsfy_classifier_1d & | classifier, |
const vbl_triple< double, int, int > * | data, | ||
const vnl_vector< double > & | wts | ||
) | const [virtual] |
Train classifier, returning weighted error.
Selects parameters of classifier which best separate examples, weighting examples appropriately when estimating the misclassification rate. data[i] is a triple, {value,class_number,weight} Returns weighted sum of error. Note that input "data" must be sorted to use this routine
Assumes two classes
Implements clsfy_builder_1d.
Definition at line 130 of file clsfy_binary_threshold_1d_builder.cxx.
clsfy_builder_1d * clsfy_binary_threshold_1d_builder::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Implements clsfy_builder_1d.
Reimplemented in clsfy_binary_threshold_1d_gini_builder.
Definition at line 214 of file clsfy_binary_threshold_1d_builder.cxx.
void clsfy_builder_1d::config | ( | vcl_istream & | as | ) | [virtual, inherited] |
Initialise the parameters from a text stream.
Default case accepts no parameters.
Definition at line 37 of file clsfy_builder_1d.cxx.
vcl_string clsfy_binary_threshold_1d_builder::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_builder_1d.
Reimplemented in clsfy_binary_threshold_1d_gini_builder.
Definition at line 202 of file clsfy_binary_threshold_1d_builder.cxx.
bool clsfy_binary_threshold_1d_builder::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_builder_1d.
Reimplemented in clsfy_binary_threshold_1d_gini_builder.
Definition at line 207 of file clsfy_binary_threshold_1d_builder.cxx.
vcl_auto_ptr< clsfy_builder_1d > clsfy_builder_1d::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_1d derivative and return that.
if | the parse fails. |
Definition at line 53 of file clsfy_builder_1d.cxx.
clsfy_classifier_1d * clsfy_binary_threshold_1d_builder::new_classifier | ( | ) | const [virtual] |
Create empty model.
Create empty classifier.
Caller is responsible for deletion
Implements clsfy_builder_1d.
Reimplemented in clsfy_binary_threshold_1d_gini_builder.
Definition at line 39 of file clsfy_binary_threshold_1d_builder.cxx.
void clsfy_binary_threshold_1d_builder::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Implements clsfy_builder_1d.
Reimplemented in clsfy_binary_threshold_1d_gini_builder.
Definition at line 222 of file clsfy_binary_threshold_1d_builder.cxx.
short clsfy_binary_threshold_1d_builder::version_no | ( | ) | const |
Version number for I/O.
Reimplemented in clsfy_binary_threshold_1d_gini_builder.
Definition at line 31 of file clsfy_binary_threshold_1d_builder.cxx.