--- /dev/null
+
+///////////////////////////////////////////////////////////////////////////
+// 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 //
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef DECISION_TREE_H
+#define DECISION_TREE_H
+
+#include "misc.h"
+#include "classifier.h"
+#include "sample_set.h"
+#include "loss_machine.h"
+
+class DecisionTree : public Classifier {
+
+ int _feature_index;
+ scalar_t _threshold;
+ scalar_t _weight;
+
+ DecisionTree *_subtree_lesser, *_subtree_greater;
+
+ static const int min_nb_samples_for_split = 5;
+
+ void pick_best_split(SampleSet *sample_set,
+ scalar_t *loss_derivatives);
+
+ void train(LossMachine *loss_machine,
+ SampleSet *sample_set,
+ scalar_t *current_responses,
+ scalar_t *loss_derivatives,
+ int depth);
+
+public:
+
+ DecisionTree();
+ ~DecisionTree();
+
+ int nb_leaves();
+ int depth();
+
+ scalar_t response(SampleSet *sample_set, int n_sample);
+
+ void train(LossMachine *loss_machine,
+ SampleSet *sample_set,
+ scalar_t *current_responses);
+
+ void tag_used_features(bool *used);
+ void re_index_features(int *new_indexes);
+
+ void read(istream *is);
+ void write(ostream *os);
+};
+
+#endif