![]() |
SynAPSE
0.6.0
Synergistic Analysis of Phase Space Evolution
|
Computes the non parametric density estimator of a set of points. More...
#include <DensityEstimator.hh>
Public Member Functions | |
| DensityEstimator () | |
| Default constructor, initilizes everything to 0. More... | |
| DensityEstimator (const std::vector< std::vector< double >> &points, const std::string algo="bin", const bool ex=true, const double norm=1.) | |
| Cloud constructor, sets vector of points on which to perform the density estimation. More... | |
| DensityEstimator (const DensityEstimator &de) | |
| Copy constructor. More... | |
| DensityEstimator & | operator= (const DensityEstimator &de) |
| Equality operator. More... | |
| double | operator() (const std::vector< double > &v) const |
| Overloaded function operator, calls Evaluate. More... | |
| double | operator() (const double &v) const |
| Overloaded function operator, calls Evaluate. More... | |
| double | operator() (const double *v) const |
| Overloaded function operator, calls Evaluate. More... | |
| ~DensityEstimator () | |
| Destructor. More... | |
| void | Initialize () |
| Initializes the requested density estimator. More... | |
| double | Evaluate (const std::vector< double > &v) const |
| Performs the density estimation at an n-point v. More... | |
| double | Evaluate (const double &v) const |
| Performs the density estimation at an n-point v. More... | |
| double | Evaluate (const double *v) const |
| Performs the density estimation at an n-point v. More... | |
| double | ContourVolume (double alpha, const std::string method="mc", const bool draw=true, std::vector< double > lower=std::vector< double >(), std::vector< double > upper=std::vector< double >(), const size_t nsamples=1e6) |
| Returns the volume of an alpha contour of the probability density function. More... | |
| double | ContourVolumeError () |
| Returns the uncertainty on the uncertainty on the reconstructed contour volume. More... | |
| TH1F * | Contour1D (size_t idx=0) const |
| Returns segments that represent the 1D contour on a function. More... | |
| TH2F * | Contour2D (size_t idx=0, size_t idy=1) const |
| Returns the requested 2D contour on a function. More... | |
| TH3F * | Contour3D (size_t idx=0, size_t idy=1, size_t idz=2) const |
| Returns the requested 3D contour on a function. More... | |
| const size_t & | GetDimension () const |
| Returns the dimension of the space in which the estimator is constructed. More... | |
| const std::vector< std::vector < double > > & | GetPoints () const |
| Returns the points on which the DensityEstimator is constructed. More... | |
| const std::vector< std::vector < double > > & | GetCVTpoints () const |
| Returns the CVT points of the space. More... | |
| Grid | GetGrid (const std::vector< size_t > &number, const std::vector< double > lower=std::vector< double >(), const std::vector< double > upper=std::vector< double >()) const |
| Returns a grid built on the DensityEstimator, which is defined everywhere. More... | |
| std::vector< TPolyLine * > | Meshing () const |
| Returns the meshing used to build the interpolation as polygons. More... | |
| std::vector< TPolyLine * > | Tesselation () const |
| Returns the tesselation of the space as polygons. More... | |
| void | SetName (const std::string &name) |
| Sets the name of the density estimator. More... | |
| TGraph * | Graph (double xmin, double xmax, size_t idx=0, std::vector< double > x=std::vector< double >()) const |
| Returns a 1D graph of the estimator in the requested axis. More... | |
| TH2F * | Graph2D (double xmin, double xmax, double ymin, double ymax, size_t idx=0, size_t idy=1, std::vector< double > x=std::vector< double >()) const |
| Returns a 2D histogram of the estimator in the requested axis. More... | |
| void | Draw (double xmin, double xmax, double ymin=0, double ymax=0, const std::string opt="", int idx=0, int idy=1, std::vector< double > x=std::vector< double >()) const |
| Draws the estimator on whichever TCanvas is currently being used (ROOT) More... | |
| void | Print (double xmin, double xmax, double ymin=0, double ymax=0, const std::string opt="", int idx=0, int idy=1, std::vector< double > x=std::vector< double >()) const |
| Creates a canvas, draws the estimator on it and save it to a file. More... | |
Private Attributes | |
| size_t | _dim |
| Dimension of the space. More... | |
| std::string | _name |
| Name of the density estimator. More... | |
| std::string | _algo |
| Density estimation algorithm. More... | |
| std::vector< std::vector < double > > | _points |
| Array of input points. More... | |
| OptimalBinning | _ob |
| Optimal binning density estimator. More... | |
| KNearestNeighbours | _knn |
| kNN density estimator More... | |
| LocalReachability | _lrd |
| LRD density estimator. More... | |
| TDE | _tde |
| Tesselation density estimator. More... | |
| PBATDE | _pbatde |
| PBA tesselation density estimator. More... | |
| ProbabilityContour | _prob |
| Stores the last requested contour. More... | |
| bool | _ex |
| Extrapolation switch. More... | |
| double | _norm |
| Norm. factor (truncated parent) More... | |
Computes the non parametric density estimator of a set of points.
Builds a non parametric density estimator based on a training set of points in n dimensions, sampled from the true parent distribution to estimate.
This class encompasses a broad array of non parametric methods to produce an estimate.
| DensityEstimator::DensityEstimator | ( | ) |
Default constructor, initilizes everything to 0.
| DensityEstimator::DensityEstimator | ( | const std::vector< std::vector< double >> & | points, |
| const std::string | algo = "bin", |
||
| const bool | ex = true, |
||
| const double | norm = 1. |
||
| ) |
Cloud constructor, sets vector of points on which to perform the density estimation.
| points | N points in a _dim dimensional space |
| algo | Defines the density estimation algorithm to be used |
| ex | Extrapolate outside the outmost points if requested |
| norm | Normalization factor for the density (if truncated distribution) |
| DensityEstimator::DensityEstimator | ( | const DensityEstimator & | de | ) |
Copy constructor.
| DensityEstimator::~DensityEstimator | ( | ) |
Destructor.
|
inline |
Returns segments that represent the 1D contour on a function.
| idx | ID of the axis in which to plot the contour |
|
inline |
Returns the requested 2D contour on a function.
| idx | ID of the first axis in which to plot the contour |
| idy | ID of the second axis in which to plot the contour |
|
inline |
Returns the requested 3D contour on a function.
| idx | ID of the first axis in which to plot the contour |
| idy | ID of the second axis in which to plot the contour |
| idz | ID of the third axis in which to plot the contour |
| double DensityEstimator::ContourVolume | ( | double | alpha, |
| const std::string | method = "mc", |
||
| const bool | draw = true, |
||
| std::vector< double > | lower = std::vector<double>(), |
||
| std::vector< double > | upper = std::vector<double>(), |
||
| const size_t | nsamples = 1e6 |
||
| ) |
Returns the volume of an alpha contour of the probability density function.
| alpha | Integrated probability to achieve |
| method | Contour volume calculation method |
| draw | Creates a grid to be able to draw the contour if requested |
| lower | Lower bounds of the bounding box in each dimension |
| upper | Upper bounds of the bounding box in each dimension |
| nsamples | Number of samples to produce for the MC estimate |
| double DensityEstimator::ContourVolumeError | ( | ) |
Returns the uncertainty on the uncertainty on the reconstructed contour volume.
| void DensityEstimator::Draw | ( | double | xmin, |
| double | xmax, | ||
| double | ymin = 0, |
||
| double | ymax = 0, |
||
| const std::string | opt = "", |
||
| int | idx = 0, |
||
| int | idy = 1, |
||
| std::vector< double > | x = std::vector<double>() |
||
| ) | const |
Draws the estimator on whichever TCanvas is currently being used (ROOT)
| xmin | Minimum of the range of the first coordinate to plot |
| xmax | Maximum of the range of the first coordinate to plot |
| ymin | Minimum of the range of the second coordinate to plot |
| ymax | Maximum of the range of the second coordinate to plot |
| opt | Drawing options |
| idx | ID of the first coordinate to represent |
| idy | ID of the second coordinate to represent |
| x | Point that the projection intersects |
| double DensityEstimator::Evaluate | ( | const std::vector< double > & | v | ) | const |
Performs the density estimation at an n-point v.
| v | Vector of coordinates of the n-point |
| double DensityEstimator::Evaluate | ( | const double & | v | ) | const |
Performs the density estimation at an n-point v.
| v | One dimensional value of the point |
| double DensityEstimator::Evaluate | ( | const double * | v | ) | const |
Performs the density estimation at an n-point v.
| v | Pointer to an array of coordinates of the n-point |
|
inline |
Returns the CVT points of the space.
|
inline |
Returns the dimension of the space in which the estimator is constructed.
| Grid DensityEstimator::GetGrid | ( | const std::vector< size_t > & | number, |
| const std::vector< double > | lower = std::vector<double>(), |
||
| const std::vector< double > | upper = std::vector<double>() |
||
| ) | const |
Returns a grid built on the DensityEstimator, which is defined everywhere.
| number | Number of steps between min and max values |
| lower | Lower bounds of the grid in each dimension |
| upper | Upper bounds of the grid in each dimension |
|
inline |
Returns the points on which the DensityEstimator is constructed.
| TGraph * DensityEstimator::Graph | ( | double | xmin, |
| double | xmax, | ||
| size_t | idx = 0, |
||
| std::vector< double > | x = std::vector<double>() |
||
| ) | const |
Returns a 1D graph of the estimator in the requested axis.
| xmin | Minimum of the range of the coordinate to plot |
| xmax | Maximum of the range of the coordinate to plot |
| idx | ID of the first coordinate to represent |
| x | Point that the projection intersects |
| TH2F * DensityEstimator::Graph2D | ( | double | xmin, |
| double | xmax, | ||
| double | ymin, | ||
| double | ymax, | ||
| size_t | idx = 0, |
||
| size_t | idy = 1, |
||
| std::vector< double > | x = std::vector<double>() |
||
| ) | const |
Returns a 2D histogram of the estimator in the requested axis.
| xmin | Minimum of the range of the first coordinate to plot |
| xmax | Maximum of the range of the first coordinate to plot |
| ymin | Minimum of the range of the second coordinate to plot |
| ymax | Maximum of the range of the second coordinate to plot |
| idx | ID of the first coordinate to represent |
| idy | ID of the second coordinate to represent |
| x | Point that the projection intersects |
| void DensityEstimator::Initialize | ( | ) |
Initializes the requested density estimator.
| std::vector< TPolyLine * > DensityEstimator::Meshing | ( | ) | const |
Returns the meshing used to build the interpolation as polygons.
|
inline |
Overloaded function operator, calls Evaluate.
| v | Vector of coordinates |
|
inline |
Overloaded function operator, calls Evaluate.
| v | One dimensional value |
|
inline |
Overloaded function operator, calls Evaluate.
| v | Pointer to an array of coordinates |
| DensityEstimator & DensityEstimator::operator= | ( | const DensityEstimator & | de | ) |
Equality operator.
| void DensityEstimator::Print | ( | double | xmin, |
| double | xmax, | ||
| double | ymin = 0, |
||
| double | ymax = 0, |
||
| const std::string | opt = "", |
||
| int | idx = 0, |
||
| int | idy = 1, |
||
| std::vector< double > | x = std::vector<double>() |
||
| ) | const |
Creates a canvas, draws the estimator on it and save it to a file.
| xmin | Minimum of the range of the first coordinate to plot |
| xmax | Maximum of the range of the first coordinate to plot |
| ymin | Minimum of the range of the second coordinate to plot |
| ymax | Maximum of the range of the second coordinate to plot |
| opt | Drawing options |
| idx | ID of the first coordinate to represent |
| idy | ID of the second coordinate to represent |
| x | Point that the projection intersects |
|
inline |
Sets the name of the density estimator.
| std::vector< TPolyLine * > DensityEstimator::Tesselation | ( | ) | const |
Returns the tesselation of the space as polygons.
|
private |
Density estimation algorithm.
|
private |
Dimension of the space.
|
private |
Extrapolation switch.
|
private |
kNN density estimator
|
private |
LRD density estimator.
|
private |
Name of the density estimator.
|
private |
Norm. factor (truncated parent)
|
private |
Optimal binning density estimator.
|
private |
PBA tesselation density estimator.
|
private |
Array of input points.
|
private |
Stores the last requested contour.
|
private |
Tesselation density estimator.
1.8.6