64 fSumOfWeights = -9999;
65 fTransitionPoint = -9999;
84 SetTransitionPoint(
evs);
95 auto redFunc = [](
const std::vector<Double_t> &
a) {
return std::accumulate(
a.begin(),
a.end(), 0.0); };
124 return TMath::Abs(a.trueValue-a.predictedValue) < TMath::Abs(b.trueValue-b.predictedValue); });
127 return (a.trueValue-a.predictedValue) < (b.trueValue-b.predictedValue); });
131 temp +=
evs[i].weight;
140 else return evs[i].trueValue-
evs[i].predictedValue;
148 fTransitionPoint = CalculateQuantile(
evs, fQuantile, fSumOfWeights,
true);
152 if(fTransitionPoint == 0){
164 if(fTransitionPoint == 0){
175 fSumOfWeights = CalculateSumOfWeights(
evs);
184 if(fSumOfWeights == -9999){
185 std::vector<LossFunctionEventInfo>
evs{
e};
186 SetSumOfWeights(
evs);
187 SetTransitionPoint(
evs);
195 else loss = fQuantile*
residual - 0.5*fQuantile*fQuantile;
196 return e.weight*
loss;
206 SetSumOfWeights(
evs);
207 SetTransitionPoint(
evs);
224 SetSumOfWeights(
evs);
225 SetTransitionPoint(
evs);
273 std::vector<LossFunctionEventInfo>
eventvec(
evs.size());
303 std::vector<LossFunctionEventInfo>
eventvec(
evs.size());
304 for (std::vector<const TMVA::Event*>::const_iterator
e=
evs.
begin();
e!=
evs.
end();
e++){
314 for (std::vector<const TMVA::Event*>::const_iterator
e=
evs.
begin();
e!=
evs.
end();
e++) {
327 else return fTransitionPoint*(
residual<0?-1.0:1.0);
372 return e.weight*
loss;
450 for (std::vector<const TMVA::Event*>::const_iterator
e=
evs.
begin();
e!=
evs.
end();
e++) {
571 for (std::vector<const TMVA::Event*>::const_iterator
e=
evs.
begin();
e!=
evs.
end();
e++) {
597 return (a.trueValue-a.predictedValue) < (b.trueValue-b.predictedValue); });
608 temp +=
evs[i].weight;
611 if (i >=
evs.size())
return 0.;
614 return evs[i].trueValue-
evs[i].predictedValue;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
const_iterator begin() const
const_iterator end() const
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 Init(std::map< const TMVA::Event *, LossFunctionEventInfo > &evinfomap, std::vector< double > &boostWeights)
absolute deviation BDT, initialize the targets and prepare for the regression
Double_t Target(LossFunctionEventInfo &e)
absolute deviation BDT, set the target for a single event
Double_t CalculateNetLoss(std::vector< LossFunctionEventInfo > &evs)
absolute deviation, determine the net loss for a collection of events
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
static Config & Instance()
static function: returns TMVA instance
void SetTarget(UInt_t itgt, Float_t value)
set the target value (dimension itgt) to value
Double_t Target(LossFunctionEventInfo &e)
huber BDT, set the target for a single event
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
void Init(std::map< const TMVA::Event *, LossFunctionEventInfo > &evinfomap, std::vector< double > &boostWeights)
huber BDT, initialize the targets and prepare for the regression
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
HuberLossFunction()
huber constructor
void SetSumOfWeights(std::vector< LossFunctionEventInfo > &evs)
huber, set the sum of weights given a collection of events
void SetTransitionPoint(std::vector< LossFunctionEventInfo > &evs)
huber, determine the transition point using the values for fQuantile and fSumOfWeights which presumab...
Double_t CalculateNetLoss(std::vector< LossFunctionEventInfo > &evs)
huber, determine the net loss for a collection of events
Double_t CalculateLoss(LossFunctionEventInfo &e)
huber, determine the loss for a single event
~HuberLossFunction()
huber destructor
Double_t fTransitionPoint
Double_t CalculateSumOfWeights(const std::vector< LossFunctionEventInfo > &evs)
huber, calculate the sum of weights for the events in the vector
Double_t CalculateMeanLoss(std::vector< LossFunctionEventInfo > &evs)
huber, determine the mean loss for a collection of events
void Init(std::vector< LossFunctionEventInfo > &evs)
figure out the residual that determines the separation between the "core" and the "tails" of the resi...
Double_t CalculateQuantile(std::vector< LossFunctionEventInfo > &evs, Double_t whichQuantile, Double_t sumOfWeights, bool abs)
huber, determine the quantile for a given input
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 Target(LossFunctionEventInfo &e)
least squares BDT, set the target for a single event
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
void Init(std::map< const TMVA::Event *, LossFunctionEventInfo > &evinfomap, std::vector< double > &boostWeights)
least squares BDT, initialize the targets and prepare for the regression
Double_t CalculateNetLoss(std::vector< LossFunctionEventInfo > &evs)
least squares , determine the net loss for a collection of events
Double_t CalculateMeanLoss(std::vector< LossFunctionEventInfo > &evs)
least squares , determine the mean loss for a collection of events
Double_t CalculateLoss(LossFunctionEventInfo &e)
least squares , determine the loss for a single event
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.