Logo ROOT   6.16/01
Reference Guide
GeneticFitter.h
Go to the documentation of this file.
1// @(#)root/tmva $Id$
2// Author: Peter Speckmayer
3
4/**********************************************************************************
5 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6 * Package: TMVA *
7 * Class : GeneticFitter *
8 * Web : http://tmva.sourceforge.net *
9 * *
10 * Description: *
11 * Fitter using a Genetic Algorithm *
12 * *
13 * Authors (alphabetical): *
14 * Peter Speckmayer <speckmay@mail.cern.ch> - CERN, Switzerland *
15 * *
16 * Copyright (c) 2005: *
17 * CERN, Switzerland *
18 * MPI-K Heidelberg, Germany *
19 * *
20 * Redistribution and use in source and binary forms, with or without *
21 * modification, are permitted according to the terms listed in LICENSE *
22 * (http://tmva.sourceforge.net/LICENSE) *
23 **********************************************************************************/
24
25#ifndef ROOT_TMVA_GeneticFitter
26#define ROOT_TMVA_GeneticFitter
27
28//////////////////////////////////////////////////////////////////////////
29// //
30// GeneticFitter //
31// //
32// Fitter using a Genetic Algorithm //
33// //
34//////////////////////////////////////////////////////////////////////////
35
36#include "TMVA/FitterBase.h"
37
38namespace TMVA {
39
40 class IFitterTarget;
41 class Interval;
42
43 class GeneticFitter : public FitterBase {
44
45 public:
46
47 GeneticFitter( IFitterTarget& target, const TString& name,
48 const std::vector<TMVA::Interval*>& ranges, const TString& theOption );
49
50 virtual ~GeneticFitter() {}
51
52 void SetParameters( Int_t cycles,
53 Int_t nsteps,
54 Int_t popSize,
55 Int_t SC_steps,
56 Int_t SC_rate,
57 Double_t SC_factor,
58 Double_t convCrit );
59
60 Double_t Run( std::vector<Double_t>& pars );
61
62 Double_t NewFitness( Double_t oldF, Double_t newF ) { return oldF + newF; }
63
64 private:
65
66 void DeclareOptions();
67
68 Int_t fCycles; // number of (nearly) independent calculation cycles
69 Int_t fNsteps; // convergence criteria: if no improvements > fConvCrit was achieved within the last fNsteps: cycle has "converged"
70 Int_t fPopSize; // number of individuals to start with
71 Int_t fSC_steps; // regulates how strong the mutations for the coordinates are: if within fSC_steps there were more than...
72 Int_t fSC_rate; // ... fSC_rate improvements, than multiply the sigma of the gaussian which defines how the random numbers are generated ...
73 Double_t fSC_factor; // ... with fSC_factor; if there were less improvements: divide by that factor; if there were exactly fSC_rate improvements, dont change anything
74 Double_t fConvCrit; // improvements bigger than fConvCrit are counted as "improvement"
75 Int_t fSaveBestFromGeneration; // store the best individuals from one generation (these are included as "hints" in the last cycle of GA calculation)
76 Int_t fSaveBestFromCycle; // store the best individuals from one cycle (these are included as "hints" in the last cycle of GA calculation)
77 Bool_t fTrim; // take care, that the number of individuals is less fPopSize (trimming is done after the fitness of the individuals is assessed)
78 UInt_t fSeed; // Seed for the random generator (0 takes random seeds)
79
80 ClassDef(GeneticFitter,0); // Fitter using a Genetic Algorithm
81 };
82
83} // namespace TMVA
84
85#endif
86
87
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
#define ClassDef(name, id)
Definition: Rtypes.h:324
Base class for TMVA fitters.
Definition: FitterBase.h:51
Double_t Run()
estimator function interface for fitting
Definition: FitterBase.cxx:74
Fitter using a Genetic Algorithm.
Definition: GeneticFitter.h:43
void DeclareOptions()
declare GA options
Double_t NewFitness(Double_t oldF, Double_t newF)
Definition: GeneticFitter.h:62
void SetParameters(Int_t cycles, Int_t nsteps, Int_t popSize, Int_t SC_steps, Int_t SC_rate, Double_t SC_factor, Double_t convCrit)
set GA configuration parameters
virtual ~GeneticFitter()
Definition: GeneticFitter.h:50
GeneticFitter(IFitterTarget &target, const TString &name, const std::vector< TMVA::Interval * > &ranges, const TString &theOption)
constructor
Interface for a fitter 'target'.
Definition: IFitterTarget.h:44
Basic string class.
Definition: TString.h:131
Abstract ClassifierFactory template that handles arbitrary types.