88 for(
UInt_t i = 0; i<evs.size(); i++)
89 sumOfWeights+=evs[i].weight;
110 while(i<evs.size()-1 && temp <= sumOfWeights*whichQuantile){
111 temp += evs[i].weight;
116 if(whichQuantile == 0) i=0;
119 if(abs)
return TMath::Abs(evs[i].trueValue-evs[i].predictedValue);
120 else return evs[i].trueValue-evs[i].predictedValue;
134 for(
UInt_t i=0; i<evs.size(); i++){
165 std::vector<LossFunctionEventInfo> evs;
192 for(
UInt_t i=0; i<evs.size(); i++)
210 for(
UInt_t i=0; i<evs.size(); i++)
231 std::vector<LossFunctionEventInfo> evinfovec;
232 for (
auto &
e: evinfomap){
241 boostWeights.push_back(weightedMedian);
242 for (
auto &
e: evinfomap ) {
244 e.second.predictedValue += weightedMedian;
253 std::vector<LossFunctionEventInfo> eventvec;
254 for (std::vector<const TMVA::Event*>::const_iterator
e=evs.begin();
e!=evs.end();
e++){
255 eventvec.push_back(
LossFunctionEventInfo(evinfomap[*
e].trueValue, evinfomap[*
e].predictedValue, (*e)->GetWeight()));
264 for (std::vector<const TMVA::Event*>::const_iterator
e=evs.begin();
e!=evs.end();
e++) {
292 for(
UInt_t j=0;j<evs.size();j++){
293 Double_t residual = evs[j].trueValue - evs[j].predictedValue;
294 diff = residual-residualMedian;
301 return (residualMedian + shift);
320 loss = residual*residual;
329 for(
UInt_t i=0; i<evs.size(); i++)
342 for(
UInt_t i=0; i<evs.size(); i++){
343 sumOfWeights+=evs[i].weight;
347 return netloss/sumOfWeights;
365 std::vector<LossFunctionEventInfo> evinfovec;
366 for (
auto &
e: evinfomap){
374 boostWeights.push_back(weightedMean);
375 for (
auto &
e: evinfomap ) {
377 e.second.predictedValue += weightedMean;
386 std::vector<LossFunctionEventInfo> eventvec;
387 for (std::vector<const TMVA::Event*>::const_iterator
e=evs.begin();
e!=evs.end();
e++){
388 eventvec.push_back(
LossFunctionEventInfo(evinfomap[*
e].trueValue, evinfomap[*
e].predictedValue, (*e)->GetWeight()));
391 for (std::vector<const TMVA::Event*>::const_iterator
e=evs.begin();
e!=evs.end();
e++) {
414 for(
UInt_t j=0;j<evs.size();j++){
415 sumOfWeights += evs[j].weight;
416 Double_t residual = evs[j].trueValue - evs[j].predictedValue;
417 weightedResidualSum += evs[j].weight*residual;
419 Double_t weightedMean = weightedResidualSum/sumOfWeights;
448 for(
UInt_t i=0; i<evs.size(); i++)
459 for(
UInt_t i=0; i<evs.size(); i++){
460 sumOfWeights+=evs[i].weight;
463 return netloss/sumOfWeights;
479 std::vector<LossFunctionEventInfo> evinfovec;
480 for (
auto &
e: evinfomap){
487 boostWeights.push_back(weightedMedian);
488 for (
auto &
e: evinfomap ) {
490 e.second.predictedValue += weightedMedian;
499 std::vector<LossFunctionEventInfo> eventvec;
500 for (std::vector<const TMVA::Event*>::const_iterator
e=evs.begin();
e!=evs.end();
e++){
501 eventvec.push_back(
LossFunctionEventInfo(evinfomap[*
e].trueValue, evinfomap[*
e].predictedValue, (*e)->GetWeight()));
504 for (std::vector<const TMVA::Event*>::const_iterator
e=evs.begin();
e!=evs.end();
e++) {
516 return (residual<0?-1.0:1.0);
533 for(
UInt_t j=0; j<evs.size(); j++)
534 sumOfWeights+=evs[j].weight;
539 while(i<evs.size() && temp <= sumOfWeights*0.5){
540 temp += evs[i].weight;
543 if (i >= evs.size())
return 0.;
546 return evs[i].trueValue-evs[i].predictedValue;
Double_t CalculateMeanLoss(std::vector< LossFunctionEventInfo > &evs)
absolute deviation, determine the mean loss for a collection of events
Double_t CalculateLoss(LossFunctionEventInfo &e)
absolute deviation, determine the loss for a single event
void Init(std::map< const TMVA::Event *, LossFunctionEventInfo > &evinfomap, std::vector< double > &boostWeights)
absolute deviation BDT, initialize the targets and prepare for the regression
Short_t Min(Short_t a, Short_t b)
Double_t Fit(std::vector< LossFunctionEventInfo > &evs)
absolute deviation BDT, determine the fit value for the terminal node based upon the events in the te...
void SetTargets(std::vector< const TMVA::Event *> &evs, std::map< const TMVA::Event *, LossFunctionEventInfo > &evinfomap)
absolute deviation BDT, set the targets for a collection of events
void SetTargets(std::vector< const TMVA::Event *> &evs, std::map< const TMVA::Event *, LossFunctionEventInfo > &evinfomap)
huber BDT, set the targets for a collection of events
Double_t CalculateLoss(LossFunctionEventInfo &e)
least squares , determine the loss for a single event
Double_t Target(LossFunctionEventInfo &e)
absolute deviation BDT, set the target for a single event
Double_t Target(LossFunctionEventInfo &e)
huber BDT, set the target for a single event
void Init(std::map< const TMVA::Event *, LossFunctionEventInfo > &evinfomap, std::vector< double > &boostWeights)
huber BDT, initialize the targets and prepare for the regression
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
void SetTargets(std::vector< const TMVA::Event *> &evs, std::map< const TMVA::Event *, LossFunctionEventInfo > &evinfomap)
least squares BDT, set the targets for a collection of events
Double_t Fit(std::vector< LossFunctionEventInfo > &evs)
huber BDT, determine the fit value for the terminal node based upon the events in the terminal node ...
Double_t CalculateSumOfWeights(std::vector< LossFunctionEventInfo > &evs)
huber, determine the quantile for a given input
HuberLossFunction()
huber constructor
Double_t CalculateNetLoss(std::vector< LossFunctionEventInfo > &evs)
least squares , determine the net loss for a collection of events
Double_t CalculateQuantile(std::vector< LossFunctionEventInfo > &evs, Double_t whichQuantile, Double_t sumOfWeights, bool abs)
huber, determine the quantile for a given input
void SetTarget(UInt_t itgt, Float_t value)
set the target value (dimension itgt) to value
void Init(std::map< const TMVA::Event *, LossFunctionEventInfo > &evinfomap, std::vector< double > &boostWeights)
least squares BDT, initialize the targets and prepare for the regression
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
void Init(std::vector< LossFunctionEventInfo > &evs)
figure out the residual that determines the separation between the "core" and the "tails" of the resi...
void SetTransitionPoint(std::vector< LossFunctionEventInfo > &evs)
huber, determine the transition point using the values for fQuantile and fSumOfWeights which presumab...
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Double_t CalculateNetLoss(std::vector< LossFunctionEventInfo > &evs)
huber, determine the net loss for a collection of events
~HuberLossFunction()
huber destructor
Double_t CalculateMeanLoss(std::vector< LossFunctionEventInfo > &evs)
huber, determine the mean loss for a collection of events
Double_t fTransitionPoint
void SetSumOfWeights(std::vector< LossFunctionEventInfo > &evs)
huber, set the sum of weights given a collection of events
Double_t CalculateMeanLoss(std::vector< LossFunctionEventInfo > &evs)
least squares , determine the mean loss for a collection of events
Double_t Fit(std::vector< LossFunctionEventInfo > &evs)
huber BDT, determine the fit value for the terminal node based upon the events in the terminal node ...
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Double_t CalculateLoss(LossFunctionEventInfo &e)
huber, determine the loss for a single event
Double_t CalculateNetLoss(std::vector< LossFunctionEventInfo > &evs)
absolute deviation, determine the net loss for a collection of events
Double_t Target(LossFunctionEventInfo &e)
least squares BDT, set the target for a single event