2 * folded-ctf is an implementation of the folded hierarchy of
3 * classifiers for object detection, developed by Francois Fleuret
6 * Copyright (c) 2008 Idiap Research Institute, http://www.idiap.ch/
7 * Written by Francois Fleuret <francois.fleuret@idiap.ch>
9 * This file is part of folded-ctf.
11 * folded-ctf is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 3 as
13 * published by the Free Software Foundation.
15 * folded-ctf is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with folded-ctf. If not, see <http://www.gnu.org/licenses/>.
27 A LossMachine provides all the methods necessary to do boosting with
28 a certain loss. Note that only the LOSS_EXPONENTIAL has been really
29 tested. Using the others may result in unexpected effects.
33 #ifndef LOSS_MACHINE_H
34 #define LOSS_MACHINE_H
37 #include "sample_set.h"
43 LossMachine(int loss_type);
45 void get_loss_derivatives(SampleSet *samples,
47 scalar_t *derivatives);
49 scalar_t loss(SampleSet *samples, scalar_t *responses);
51 scalar_t optimal_weight(SampleSet *sample_set,
52 scalar_t *weak_learner_responses,
53 scalar_t *current_responses);
55 /* This method returns in sample_nb_occurences[k] the number of time
56 the example k was sampled, and in sample_responses[k] the
57 consistent response so that the overall loss remains the same. If
58 allow_duplicates is set to 1, all samples will have an identical
59 response (i.e. weight), but some may have more than one
60 occurence. On the contrary, if allow_duplicates is 0, samples
61 will all have only one occurence (or zero) but the responses may
62 vary to account for the multiple sampling. */
64 void subsample(int nb, scalar_t *labels, scalar_t *responses,
65 int nb_to_sample, int *sample_nb_occurences, scalar_t *sample_responses,
66 int allow_duplicates);