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