X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=boosted_classifier.h;fp=boosted_classifier.h;h=8f52e5a8e7c64498431a89e083d9e9b575998879;hb=d922ad61d35e9a6996730bec24b16f8bf7bc426c;hp=0000000000000000000000000000000000000000;hpb=3bb118f5a9462d02ff7d99ef28ecc0d7e23529f9;p=folded-ctf.git diff --git a/boosted_classifier.h b/boosted_classifier.h new file mode 100644 index 0000000..8f52e5a --- /dev/null +++ b/boosted_classifier.h @@ -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 . // +// // +// Written by Francois Fleuret, (C) IDIAP // +// Contact 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