CMS 3D CMS Logo

List of all members | Public Member Functions
emtf::LeastSquares Class Reference

#include <LossFunctions.h>

Inheritance diagram for emtf::LeastSquares:
emtf::LossFunction

Public Member Functions

double fit (std::vector< Event * > &v) override
 
int id () override
 
 LeastSquares ()
 
std::string name () override
 
double target (Event *e) override
 
 ~LeastSquares () override
 
- Public Member Functions inherited from emtf::LossFunction
virtual ~LossFunction ()=default
 

Detailed Description

Definition at line 39 of file LossFunctions.h.

Constructor & Destructor Documentation

◆ LeastSquares()

emtf::LeastSquares::LeastSquares ( )
inline

Definition at line 41 of file LossFunctions.h.

41 {}

◆ ~LeastSquares()

emtf::LeastSquares::~LeastSquares ( )
inlineoverride

Definition at line 42 of file LossFunctions.h.

42 {}

Member Function Documentation

◆ fit()

double emtf::LeastSquares::fit ( std::vector< Event * > &  v)
inlineoverridevirtual

Implements emtf::LossFunction.

Definition at line 49 of file LossFunctions.h.

49  {
50  // The average of the residuals minmizes the Loss Function for LS.
51 
52  double SUM = 0;
53  for (unsigned int i = 0; i < v.size(); i++) {
54  Event* e = v[i];
55  SUM += e->trueValue - e->predictedValue;
56  }
57 
58  return SUM / v.size();
59  }

References MillePedeFileConverter_cfg::e, mps_fire::i, SUM, and findQualityFiles::v.

Referenced by trackingPlots.Iteration::modules().

◆ id()

int emtf::LeastSquares::id ( void  )
inlineoverridevirtual

Implements emtf::LossFunction.

Definition at line 61 of file LossFunctions.h.

61 { return 1; }

◆ name()

std::string emtf::LeastSquares::name ( void  )
inlineoverridevirtual

Implements emtf::LossFunction.

Definition at line 60 of file LossFunctions.h.

60 { return "Least_Squares"; }

Referenced by config.CFG::__str__(), validation.Sample::digest(), and VIDSelectorBase.VIDSelectorBase::initialize().

◆ target()

double emtf::LeastSquares::target ( Event e)
inlineoverridevirtual

Implements emtf::LossFunction.

Definition at line 44 of file LossFunctions.h.

44  {
45  // Each tree fits the residuals when using LeastSquares.
46  return e->trueValue - e->predictedValue;
47  }

References MillePedeFileConverter_cfg::e.

SUM
#define SUM(A, B)
Definition: Simplify_begin.h:52
mps_fire.i
i
Definition: mps_fire.py:428
findQualityFiles.v
v
Definition: findQualityFiles.py:179
Event
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37