#include <clsfy_binary_threshold_1d_gini_builder.h>
Public Member Functions | |
clsfy_binary_threshold_1d_gini_builder () | |
virtual | ~clsfy_binary_threshold_1d_gini_builder () |
virtual clsfy_classifier_1d * | new_classifier () const |
Create empty model. | |
virtual double | build_gini (clsfy_classifier_1d &classifier, const vnl_vector< double > &inputs, const vcl_vector< unsigned > &outputs) const |
Build a binary_threshold classifier. | |
virtual double | build_gini_from_sorted_data (clsfy_classifier_1d &classifier, const vcl_vector< vbl_triple< double, int, int > > &data) 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 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 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. |
Definition at line 21 of file clsfy_binary_threshold_1d_gini_builder.h.
clsfy_binary_threshold_1d_gini_builder::clsfy_binary_threshold_1d_gini_builder | ( | ) |
Definition at line 23 of file clsfy_binary_threshold_1d_gini_builder.cxx.
clsfy_binary_threshold_1d_gini_builder::~clsfy_binary_threshold_1d_gini_builder | ( | ) | [virtual] |
Definition at line 29 of file clsfy_binary_threshold_1d_gini_builder.cxx.
void clsfy_binary_threshold_1d_gini_builder::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Reimplemented from clsfy_binary_threshold_1d_builder.
Definition at line 265 of file clsfy_binary_threshold_1d_gini_builder.cxx.
void clsfy_binary_threshold_1d_gini_builder::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Reimplemented from clsfy_binary_threshold_1d_builder.
Definition at line 256 of file clsfy_binary_threshold_1d_gini_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, inherited] |
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, inherited] |
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, inherited] |
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.
double clsfy_binary_threshold_1d_gini_builder::build_gini | ( | clsfy_classifier_1d & | classifier, |
const vnl_vector< double > & | inputs, | ||
const vcl_vector< unsigned > & | outputs | ||
) | const [virtual] |
Build a binary_threshold classifier.
Train classifier Selects parameters of classifier which best separate examples from two classes, Uses the gini impurity index Note it returns the -reduction in Gini impurity produced by the split Not the misclassification rate (i.e. but minimise as per error rate)
Definition at line 55 of file clsfy_binary_threshold_1d_gini_builder.cxx.
double clsfy_binary_threshold_1d_gini_builder::build_gini_from_sorted_data | ( | clsfy_classifier_1d & | classifier, |
const vcl_vector< vbl_triple< double, int, int > > & | data | ||
) | const [virtual] |
Train classifier, returning weighted error.
Assumes two classes Note that input "data" must be sorted to use this routine Return -improvement in impurity (as normally these builders minimise)
Definition at line 93 of file clsfy_binary_threshold_1d_gini_builder.cxx.
clsfy_builder_1d * clsfy_binary_threshold_1d_gini_builder::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Reimplemented from clsfy_binary_threshold_1d_builder.
Definition at line 249 of file clsfy_binary_threshold_1d_gini_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_gini_builder::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_binary_threshold_1d_builder.
Definition at line 202 of file clsfy_binary_threshold_1d_gini_builder.cxx.
bool clsfy_binary_threshold_1d_gini_builder::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_binary_threshold_1d_builder.
Definition at line 207 of file clsfy_binary_threshold_1d_gini_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_gini_builder::new_classifier | ( | ) | const [virtual] |
Create empty model.
Create empty classifier.
Caller is responsible for deletion
Reimplemented from clsfy_binary_threshold_1d_builder.
Definition at line 43 of file clsfy_binary_threshold_1d_gini_builder.cxx.
void clsfy_binary_threshold_1d_gini_builder::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Reimplemented from clsfy_binary_threshold_1d_builder.
Definition at line 241 of file clsfy_binary_threshold_1d_gini_builder.cxx.
short clsfy_binary_threshold_1d_gini_builder::version_no | ( | ) | const |
Version number for I/O.
Reimplemented from clsfy_binary_threshold_1d_builder.
Definition at line 35 of file clsfy_binary_threshold_1d_gini_builder.cxx.