automatic commit
[folded-ctf.git] / boosted_classifier.h
diff --git a/boosted_classifier.h b/boosted_classifier.h
new file mode 100644 (file)
index 0000000..8f52e5a
--- /dev/null
@@ -0,0 +1,58 @@
+
+///////////////////////////////////////////////////////////////////////////
+// This program is free software: you can redistribute it and/or modify  //
+// it under the terms of the version 3 of the GNU General Public License //
+// as published by the Free Software Foundation.                         //
+//                                                                       //
+// This program is distributed in the hope that it will be useful, but   //
+// WITHOUT ANY WARRANTY; without even the implied warranty of            //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      //
+// General Public License for more details.                              //
+//                                                                       //
+// You should have received a copy of the GNU General Public License     //
+// along with this program. If not, see <http://www.gnu.org/licenses/>.  //
+//                                                                       //
+// Written by Francois Fleuret, (C) IDIAP                                //
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports        //
+///////////////////////////////////////////////////////////////////////////
+
+/*
+
+  This class is an implementation of the Classifier with a boosting of
+  tree. It works with samples from R^n and has no concept of the
+  pi-features.
+
+*/
+
+#ifndef BOOSTED_CLASSIFIER_H
+#define BOOSTED_CLASSIFIER_H
+
+#include "classifier.h"
+#include "sample_set.h"
+#include "decision_tree.h"
+#include "loss_machine.h"
+
+class BoostedClassifier : public Classifier {
+public:
+
+  int _loss_type;
+  int _nb_weak_learners;
+  DecisionTree **_weak_learners;
+
+public:
+
+  BoostedClassifier(int nb_weak_learners);
+  BoostedClassifier();
+  virtual ~BoostedClassifier();
+
+  virtual scalar_t response(SampleSet *sample_set, int n_sample);
+  virtual void train(LossMachine *loss_machine, SampleSet *train, scalar_t *response);
+
+  virtual void tag_used_features(bool *used);
+  virtual void re_index_features(int *new_indexes);
+
+  virtual void read(istream *is);
+  virtual void write(ostream *os);
+};
+
+#endif