Go to the documentation of this file.00001 #ifndef clsfy_binary_hyperplane_gmrho_builder_h
00002 #define clsfy_binary_hyperplane_gmrho_builder_h
00003
00004
00005
00006
00007
00008 #include <vcl_string.h>
00009 #include <vcl_iosfwd.h>
00010
00011 #include <vnl/io/vnl_io_vector.h>
00012 #include <vnl/io/vnl_io_matrix.h>
00013 #include <vnl/vnl_matrix.h>
00014 #include <vnl/vnl_vector.h>
00015 #include <clsfy/clsfy_binary_hyperplane_ls_builder.h>
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 class clsfy_binary_hyperplane_gmrho_builder : public clsfy_binary_hyperplane_ls_builder
00030 {
00031 private:
00032
00033 mutable vnl_vector<double> weights_;
00034
00035
00036 mutable unsigned num_examples_;
00037
00038 mutable unsigned num_vars_;
00039
00040 mutable double epsilon_;
00041
00042
00043 bool auto_estimate_sigma_;
00044
00045 double sigma_preset_;
00046
00047
00048
00049 double estimate_sigma(const vnl_matrix<double>& data,
00050 const vnl_vector<double>& y) const;
00051
00052 void determine_weights(const vnl_matrix<double>& data,
00053 const vnl_vector<double>& y,
00054 double sigma) const;
00055 public:
00056
00057
00058 clsfy_binary_hyperplane_gmrho_builder():
00059 clsfy_binary_hyperplane_ls_builder(),
00060 num_examples_(0),num_vars_(0),epsilon_(1.0E-8),
00061 auto_estimate_sigma_(true),sigma_preset_(1.0) {}
00062
00063
00064
00065 double build(clsfy_classifier_base &classifier,
00066 mbl_data_wrapper<vnl_vector<double> > &inputs,
00067 const vcl_vector<unsigned> &outputs) const;
00068
00069
00070
00071
00072
00073 virtual double build(clsfy_classifier_base& model,
00074 mbl_data_wrapper<vnl_vector<double> >& inputs,
00075 unsigned nClasses,
00076 const vcl_vector<unsigned> &outputs) const;
00077
00078
00079 short version_no() const;
00080
00081
00082 vcl_string is_a() const;
00083
00084
00085 virtual bool is_class(vcl_string const& s) const;
00086
00087
00088 void print_summary(vcl_ostream& os) const;
00089
00090
00091
00092 virtual clsfy_builder_base* clone() const;
00093
00094
00095 void set_auto_estimate_sigma(bool bAuto) {auto_estimate_sigma_ = bAuto;}
00096
00097 void set_sigma_preset(double sigma_preset) {sigma_preset_ = sigma_preset;}
00098
00099 virtual void b_write(vsl_b_ostream &) const;
00100 virtual void b_read(vsl_b_istream &);
00101 };
00102
00103 #endif // clsfy_binary_hyperplane_gmrho_builder_h