MINT2
Public Member Functions | Private Attributes | List of all members
HyperStatisticsFinder Class Reference

#include <HyperStatisticsFinder.h>

Inheritance diagram for HyperStatisticsFinder:
HyperMeanFinder HyperMinMaxFinder HyperWidthErrorFinder HyperWidthFinder

Public Member Functions

 HyperStatisticsFinder (int dimension, bool mean=1, bool width=1, bool widthError=1, bool keepOrderedEvents=0)
 
 HyperStatisticsFinder (const HyperPoint &point, bool mean=1, bool width=1, bool widthError=1, bool keepOrderedEvents=0)
 
void add (const HyperPoint &x)
 
double correlation (int i, int j) const
 
double covarience (int i, int j) const
 
double mean (int i) const
 
double meanError (int i) const
 
double width (int i) const
 
double getMin (int i) const
 
double getMax (int i) const
 
HyperPoint mean () const
 
HyperPoint meanError () const
 
HyperPoint width () const
 
HyperPoint getMin () const
 
HyperPoint getMax () const
 
const StatisticsFindergetStatisticsFinder (int i) const
 
virtual ~HyperStatisticsFinder ()
 

Private Attributes

int _dim
 
std::vector< std::vector< StatisticsFinder > > _statisticsFinders
 

Detailed Description

HyperPlot, Author: Sam Harnew, sam.h.nosp@m.arne.nosp@m.w@gma.nosp@m.il.c.nosp@m.om , Date: Jan 2017

This class is used to find statistics (e.g. mean, width...) of a multi dimensional (Hyper) dataset. To do so it uses a 2D array of the StatisticsFinder class. I suspect there is a computationally less expensive way to do this, but this does the job for now.

Definition at line 22 of file HyperStatisticsFinder.h.

Constructor & Destructor Documentation

◆ HyperStatisticsFinder() [1/2]

HyperStatisticsFinder::HyperStatisticsFinder ( int  dimension,
bool  mean = 1,
bool  width = 1,
bool  widthError = 1,
bool  keepOrderedEvents = 0 
)

In the constuctor you decide what things you want to be stored once you start adding values. This will determine what statistics you are able to calcuate later. Also decide the dimensionality of each data point.

Definition at line 5 of file HyperStatisticsFinder.cpp.

5  :
6  _dim(dim)
7 {
8 
9  for (int i = 0; i < _dim; i++){
10  std::vector<StatisticsFinder> statsFinders;
11  for (int j = 0; j < _dim; j++){
12  statsFinders.push_back( StatisticsFinder(mean, width, widthError, keepOrderedEvents) );
13  }
14  _statisticsFinders.push_back(statsFinders);
15  }
16 
17 }
std::vector< std::vector< StatisticsFinder > > _statisticsFinders

◆ HyperStatisticsFinder() [2/2]

HyperStatisticsFinder::HyperStatisticsFinder ( const HyperPoint point,
bool  mean = 1,
bool  width = 1,
bool  widthError = 1,
bool  keepOrderedEvents = 0 
)

In the constuctor you decide what things you want to be stored once you start adding values. This will determine what statistics you are able to calcuate later. Also decide the dimensionality of each data point by passing a HyperPoint. This point is also added to the HyperStatisticsFinder

Definition at line 19 of file HyperStatisticsFinder.cpp.

19  :
20  _dim(x.getDimension())
21 {
22 
23  for (int i = 0; i < _dim; i++){
24  std::vector<StatisticsFinder> statsFinders;
25  for (int j = 0; j < _dim; j++){
26  statsFinders.push_back( StatisticsFinder(mean, width, widthError, keepOrderedEvents) );
27  }
28  _statisticsFinders.push_back(statsFinders);
29  }
30 
31  add(x);
32 
33 }
std::vector< std::vector< StatisticsFinder > > _statisticsFinders
void add(const HyperPoint &x)

◆ ~HyperStatisticsFinder()

HyperStatisticsFinder::~HyperStatisticsFinder ( )
virtual

Destructor

Definition at line 134 of file HyperStatisticsFinder.cpp.

134  {
135 
136 }

Member Function Documentation

◆ add()

void HyperStatisticsFinder::add ( const HyperPoint x)

add a HyperPoint to the HyperStatisticsFinder

Definition at line 35 of file HyperStatisticsFinder.cpp.

35  {
36 
37  if (x.getDimension() != _dim) ERROR_LOG << "The HyperPoint you are adding is not of the correct dimension";
38 
39  for (int i = 0; i < _dim; i++){
40  for (int j = 0; j < _dim; j++){
41  double val = 0.0;
42  if (i == j) val = x.at(i);
43  if (i != j) val = x.at(i)*x.at(j);
44  _statisticsFinders.at(i).at(j).add( val, x.getWeight() );
45  }
46  }
47 
48 }
std::vector< std::vector< StatisticsFinder > > _statisticsFinders
#define ERROR_LOG
const double & at(int i) const
Definition: HyperPoint.cpp:433
double getWeight(int i=0) const
Definition: Weights.cpp:40
int getDimension() const
Definition: HyperPoint.h:99

◆ correlation()

double HyperStatisticsFinder::correlation ( int  i,
int  j 
) const

get the correlation coefficient of dimesnions i and j

Definition at line 50 of file HyperStatisticsFinder.cpp.

50  {
51 
52  return covarience(i,j)/sqrt(covarience(i,i)*covarience(j,j));
53 
54 }
double covarience(int i, int j) const

◆ covarience()

double HyperStatisticsFinder::covarience ( int  i,
int  j 
) const

get the covarience of dimesnions i and j

Definition at line 61 of file HyperStatisticsFinder.cpp.

61  {
62 
63  if (i == j) {
64  return _statisticsFinders.at(i).at(i).varience();
65  }
66 
67  const StatisticsFinder& statsI = _statisticsFinders.at(i).at(i);
68  const StatisticsFinder& statsJ = _statisticsFinders.at(j).at(j);
69  const StatisticsFinder& statsIJ = _statisticsFinders.at(i).at(j);
70 
71  double expI = statsI .mean();
72  double expJ = statsJ .mean();
73  double expIJ = statsIJ.mean();
74 
75  return expIJ - expI*expJ;
76 
77 }
std::vector< std::vector< StatisticsFinder > > _statisticsFinders
double mean() const

◆ getMax() [1/2]

double HyperStatisticsFinder::getMax ( int  i) const

get the maximum in a given dimension

Definition at line 96 of file HyperStatisticsFinder.cpp.

96  {
97  return _statisticsFinders.at(i).at(i).getMax();
98 }
std::vector< std::vector< StatisticsFinder > > _statisticsFinders

◆ getMax() [2/2]

HyperPoint HyperStatisticsFinder::getMax ( ) const

get a HyperPoint filled with the maximum of each dimension

Definition at line 127 of file HyperStatisticsFinder.cpp.

127  {
128  HyperPoint point(_dim);
129  for (int i = 0; i < _dim; i++) point.at(i) = _statisticsFinders.at(i).at(i).getMax();
130  return point;
131 }
std::vector< std::vector< StatisticsFinder > > _statisticsFinders

◆ getMin() [1/2]

double HyperStatisticsFinder::getMin ( int  i) const

get the minimum in a given dimension

Definition at line 92 of file HyperStatisticsFinder.cpp.

92  {
93  return _statisticsFinders.at(i).at(i).getMin();
94 }
std::vector< std::vector< StatisticsFinder > > _statisticsFinders

◆ getMin() [2/2]

HyperPoint HyperStatisticsFinder::getMin ( ) const

get a HyperPoint filled with the minimum of each dimension

Definition at line 121 of file HyperStatisticsFinder.cpp.

121  {
122  HyperPoint point(_dim);
123  for (int i = 0; i < _dim; i++) point.at(i) = _statisticsFinders.at(i).at(i).getMin();
124  return point;
125 }
std::vector< std::vector< StatisticsFinder > > _statisticsFinders

◆ getStatisticsFinder()

const StatisticsFinder& HyperStatisticsFinder::getStatisticsFinder ( int  i) const
inline

get the statistics finder for a specific dimesion

Definition at line 77 of file HyperStatisticsFinder.h.

◆ mean() [1/2]

double HyperStatisticsFinder::mean ( int  i) const

get the mean in a given dimension

Definition at line 80 of file HyperStatisticsFinder.cpp.

80  {
81  return _statisticsFinders.at(i).at(i).mean();
82 }
std::vector< std::vector< StatisticsFinder > > _statisticsFinders

◆ mean() [2/2]

HyperPoint HyperStatisticsFinder::mean ( ) const

get a HyperPoint filled with the mean of each dimension

Definition at line 103 of file HyperStatisticsFinder.cpp.

103  {
104  HyperPoint point(_dim);
105  for (int i = 0; i < _dim; i++) point.at(i) = _statisticsFinders.at(i).at(i).mean();
106  return point;
107 }
std::vector< std::vector< StatisticsFinder > > _statisticsFinders

◆ meanError() [1/2]

double HyperStatisticsFinder::meanError ( int  i) const

get the meanError in a given dimension

Definition at line 84 of file HyperStatisticsFinder.cpp.

84  {
85  return _statisticsFinders.at(i).at(i).meanError();
86 }
std::vector< std::vector< StatisticsFinder > > _statisticsFinders

◆ meanError() [2/2]

HyperPoint HyperStatisticsFinder::meanError ( ) const

get a HyperPoint filled with the error on the mean of each dimension

Definition at line 109 of file HyperStatisticsFinder.cpp.

109  {
110  HyperPoint point(_dim);
111  for (int i = 0; i < _dim; i++) point.at(i) = _statisticsFinders.at(i).at(i).meanError();
112  return point;
113 }
std::vector< std::vector< StatisticsFinder > > _statisticsFinders

◆ width() [1/2]

double HyperStatisticsFinder::width ( int  i) const

get the width in a given dimension

Definition at line 88 of file HyperStatisticsFinder.cpp.

88  {
89  return _statisticsFinders.at(i).at(i).width();
90 }
std::vector< std::vector< StatisticsFinder > > _statisticsFinders

◆ width() [2/2]

HyperPoint HyperStatisticsFinder::width ( ) const

get a HyperPoint filled with the width of each dimension

Definition at line 115 of file HyperStatisticsFinder.cpp.

115  {
116  HyperPoint point(_dim);
117  for (int i = 0; i < _dim; i++) point.at(i) = _statisticsFinders.at(i).at(i).width();
118  return point;
119 }
std::vector< std::vector< StatisticsFinder > > _statisticsFinders

Member Data Documentation

◆ _dim

int HyperStatisticsFinder::_dim
private

dimension of the HyperStatisticsFinder

Definition at line 24 of file HyperStatisticsFinder.h.

◆ _statisticsFinders

std::vector< std::vector < StatisticsFinder > > HyperStatisticsFinder::_statisticsFinders
private

matrix of StatisticsFinder's. Need a matrix rather than a vector in order to calculate the covarience between two dimensions.

Definition at line 27 of file HyperStatisticsFinder.h.


The documentation for this class was generated from the following files: