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 * *
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 * (see tmva/doc/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 ) override;
62
63 Double_t NewFitness( Double_t oldF, Double_t newF ) { return oldF + newF; }
64
65 private:
66
67 void DeclareOptions() override;
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 ClassDefOverride(GeneticFitter,0); // Fitter using a Genetic Algorithm
82 };
83
84} // namespace TMVA
85
86#endif
87
88
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
char name[80]
Definition TGX11.cxx:148
FitterBase(IFitterTarget &target, const TString &name, const std::vector< TMVA::Interval * > ranges, const TString &theOption)
constructor
Double_t Run()
estimator function interface for fitting
Double_t fSC_factor
... with fSC_factor; if there were less improvements: divide by that factor; if there were exactly fS...
Double_t fConvCrit
improvements bigger than fConvCrit are counted as "improvement"
Int_t fSC_rate
... fSC_rate improvements, than multiply the sigma of the gaussian which defines how the random numbe...
Double_t NewFitness(Double_t oldF, Double_t newF)
Int_t fNsteps
convergence criteria: if no improvements > fConvCrit was achieved within the last fNsteps: cycle has ...
Int_t fCycles
number of (nearly) independent calculation cycles
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
Int_t fSC_steps
regulates how strong the mutations for the coordinates are: if within fSC_steps there were more than....
Int_t fSaveBestFromGeneration
store the best individuals from one generation (these are included as "hints" in the last cycle of GA...
Bool_t fTrim
take care, that the number of individuals is less fPopSize (trimming is done after the fitness of the...
UInt_t fSeed
Seed for the random generator (0 takes random seeds).
Int_t fSaveBestFromCycle
store the best individuals from one cycle (these are included as "hints" in the last cycle of GA calc...
Int_t fPopSize
number of individuals to start with
GeneticFitter(IFitterTarget &target, const TString &name, const std::vector< TMVA::Interval * > &ranges, const TString &theOption)
constructor
void DeclareOptions() override
declare GA options
Interface for a fitter 'target'.
The TMVA::Interval Class.
Definition Interval.h:61
Basic string class.
Definition TString.h:138
create variable transformations