Logo ROOT   6.08/07
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 #ifndef ROOT_TMVA_FitterBase
37 #include "TMVA/FitterBase.h"
38 #endif
39 
40 namespace TMVA {
41 
42  class IFitterTarget;
43  class Interval;
44 
45  class GeneticFitter : public FitterBase {
46 
47  public:
48 
49  GeneticFitter( IFitterTarget& target, const TString& name,
50  const std::vector<TMVA::Interval*>& ranges, const TString& theOption );
51 
52  virtual ~GeneticFitter() {}
53 
54  void SetParameters( Int_t cycles,
55  Int_t nsteps,
56  Int_t popSize,
57  Int_t SC_steps,
58  Int_t SC_rate,
59  Double_t SC_factor,
60  Double_t convCrit );
61 
62  Double_t Run( std::vector<Double_t>& pars );
63 
64  Double_t NewFitness( Double_t oldF, Double_t newF ) { return oldF + newF; }
65 
66  private:
67 
68  void DeclareOptions();
69 
70  Int_t fCycles; // number of (nearly) independent calculation cycles
71  Int_t fNsteps; // convergence criteria: if no improvements > fConvCrit was achieved within the last fNsteps: cycle has "converged"
72  Int_t fPopSize; // number of individuals to start with
73  Int_t fSC_steps; // regulates how strong the mutations for the coordinates are: if within fSC_steps there were more than...
74  Int_t fSC_rate; // ... fSC_rate improvements, than multiply the sigma of the gaussion which defines how the random numbers are generated ...
75  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
76  Double_t fConvCrit; // improvements bigger than fConvCrit are counted as "improvement"
77  Int_t fSaveBestFromGeneration; // store the best individuals from one generation (these are included as "hints" in the last cycle of GA calculation)
78  Int_t fSaveBestFromCycle; // store the best individuals from one cycle (these are included as "hints" in the last cycle of GA calculation)
79  Bool_t fTrim; // take care, that the number of individuals is less fPopSize (trimming is done after the fitness of the individuals is assessed)
80  UInt_t fSeed; // Seed for the random generator (0 takes random seeds)
81 
82  ClassDef(GeneticFitter,0); // Fitter using a Genetic Algorithm
83  };
84 
85 } // namespace TMVA
86 
87 #endif
88 
89 
Double_t NewFitness(Double_t oldF, Double_t newF)
Definition: GeneticFitter.h:64
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual ~GeneticFitter()
Definition: GeneticFitter.h:52
#define ClassDef(name, id)
Definition: Rtypes.h:254
Double_t Run()
estimator function interface for fitting
Definition: FitterBase.cxx:80
GeneticFitter(IFitterTarget &target, const TString &name, const std::vector< TMVA::Interval *> &ranges, const TString &theOption)
constructor
unsigned int UInt_t
Definition: RtypesCore.h:42
double Double_t
Definition: RtypesCore.h:55
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
void DeclareOptions()
declare GA options
Abstract ClassifierFactory template that handles arbitrary types.
char name[80]
Definition: TGX11.cxx:109