33 #ifndef ROOT_TMVA_RuleFitParams
34 #define ROOT_TMVA_RuleFitParams
52 virtual ~RuleFitParams();
57 void SetMsgType( EMsgType t );
60 void SetRuleFit( RuleFit *rf ) { fRuleFit = rf; }
63 void SetGDNPathSteps( Int_t np ) { fGDNPathSteps = np; }
66 void SetGDPathStep( Double_t s ) { fGDPathStep = s; }
69 void SetGDTauRange( Double_t t0, Double_t t1 )
71 fGDTauMin = (t0>1.0 ? 1.0:(t0<0.0 ? 0.0:t0));
72 fGDTauMax = (t1>1.0 ? 1.0:(t1<0.0 ? 0.0:t1));
73 if (fGDTauMax<fGDTauMin) fGDTauMax = fGDTauMin;
77 void SetGDTauScan( UInt_t n ) { fGDTauScan = n; }
80 void SetGDTau( Double_t t ) { fGDTau = t; }
83 void SetGDErrScale( Double_t s ) { fGDErrScale = s; }
84 void SetGDTauPrec( Double_t p ) { fGDTauPrec=p; CalcGDNTau(); fGDTauVec.resize(fGDNTau); }
87 Int_t Type(
const Event * e )
const;
89 UInt_t GetPathIdx1()
const {
return fPathIdx1; }
90 UInt_t GetPathIdx2()
const {
return fPathIdx2; }
91 UInt_t GetPerfIdx1()
const {
return fPerfIdx1; }
92 UInt_t GetPerfIdx2()
const {
return fPerfIdx2; }
95 Double_t LossFunction(
const Event& e )
const;
98 Double_t LossFunction( UInt_t evtidx )
const;
99 Double_t LossFunction( UInt_t evtidx, UInt_t itau )
const;
102 Double_t Risk(UInt_t ind1, UInt_t ind2, Double_t neff)
const;
103 Double_t Risk(UInt_t ind1, UInt_t ind2, Double_t neff, UInt_t itau)
const;
106 Double_t RiskPath()
const {
return Risk(fPathIdx1,fPathIdx2,fNEveEffPath); }
107 Double_t RiskPerf()
const {
return Risk(fPerfIdx1,fPerfIdx2,fNEveEffPerf); }
108 Double_t RiskPerf( UInt_t itau )
const {
return Risk(fPerfIdx1,fPerfIdx2,fNEveEffPerf,itau); }
111 UInt_t RiskPerfTst();
114 Double_t Penalty()
const;
128 typedef std::vector<const TMVA::Event *>::const_iterator EventItr;
134 void CalcGDNTau() { fGDNTau =
static_cast<UInt_t
>(1.0/fGDTauPrec)+1;
if (fGDNTau>100000) fGDNTau=100000; }
137 void FillCoefficients();
143 Double_t ErrorRateBin();
146 Double_t ErrorRateReg();
149 Double_t ErrorRateRocRaw( std::vector<Double_t> & sFsig, std::vector<Double_t> & sFbkg );
150 Double_t ErrorRateRoc();
151 void ErrorRateRocTst();
157 void MakeGradientVector();
160 void UpdateCoefficients();
163 Double_t CalcAverageResponse();
164 Double_t CalcAverageResponseOLD();
167 Double_t CalcAverageTruth();
170 void EvaluateAverage(UInt_t ind1, UInt_t ind2,
171 std::vector<Double_t> &avsel,
172 std::vector<Double_t> &avrul);
175 void EvaluateAveragePath() { EvaluateAverage( fPathIdx1, fPathIdx2, fAverageSelectorPath, fAverageRulePath ); }
178 void EvaluateAveragePerf() { EvaluateAverage( fPerfIdx1, fPerfIdx2, fAverageSelectorPerf, fAverageRulePerf ); }
181 void MakeTstGradientVector();
182 void UpdateTstCoefficients();
183 void CalcTstAverageResponse();
187 RuleEnsemble * fRuleEnsemble;
199 Double_t fNEveEffPath;
200 Double_t fNEveEffPerf;
202 std::vector<Double_t> fAverageSelectorPath;
203 std::vector<Double_t> fAverageRulePath;
204 std::vector<Double_t> fAverageSelectorPerf;
205 std::vector<Double_t> fAverageRulePerf;
207 std::vector<Double_t> fGradVec;
208 std::vector<Double_t> fGradVecLin;
210 std::vector< std::vector<Double_t> > fGradVecTst;
211 std::vector< std::vector<Double_t> > fGradVecLinTst;
213 std::vector<Double_t> fGDErrTst;
214 std::vector<Char_t> fGDErrTstOK;
215 std::vector< std::vector<Double_t> > fGDCoefTst;
216 std::vector< std::vector<Double_t> > fGDCoefLinTst;
217 std::vector<Double_t> fGDOfsTst;
218 std::vector< Double_t > fGDTauVec;
226 Double_t fGDPathStep;
228 Double_t fGDErrScale;
230 Double_t fAverageTruth;
232 std::vector<Double_t> fFstar;
233 Double_t fFstarMedian;
237 Double_t fNTErrorRate;
242 Double_t *fNTLinCoeff;
251 mutable MsgLogger* fLogger;
252 MsgLogger& Log()
const {
return *fLogger; }
262 Bool_t operator()( Double_t first, Double_t second )
const {
return TMath::Abs(first) < TMath::Abs(second); }