GeneticAlgoithm
Implementation of the genetic algorithm
|
Class implementing a \(\chi^2/ndf\) figure of merit. More...
#include <Chi2FitFigureOfMerit.h>
Public Member Functions | |
Chi2FitFigureOfMerit () | |
~Chi2FitFigureOfMerit () | |
void | addData (const std::vector< double > &x, double y, double ey) |
void | clearData () |
double | evaluate (IModel *model) const |
bool | isBetterThan (double scoreToTest, double referenceScore) const |
![]() | |
IFigureOfMerit () | |
virtual | ~IFigureOfMerit () |
virtual bool | accept (IModel *model) const |
virtual bool | isBetterThan (IModel *scoreToTest, IModel *referenceModel) const |
void | setAcceptThreshold (double acceptThreshold) |
double | getAcceptThreshold () const |
Protected Attributes | |
std::vector< std::vector< double > > | m_x |
Stores the \(\vec{x_i}\) coordinates. | |
std::vector< double > | m_y |
Stores the \(y_i\) coordinates. | |
std::vector< double > | m_ey |
Stores the \(\sigma_{y_i}\) errors. | |
![]() | |
double | m_acceptThreshold |
Stores the score threshold to accept a model as a final answer. | |
Additional Inherited Members | |
![]() | |
virtual bool | accept (double scrore) const |
Class implementing a \(\chi^2/ndf\) figure of merit.
The \(\chi^2/ndf\) is computed by comparing a model to a dataset:
\[ \chi^2/ndf = \frac{1}{N}\sum_{i=0}^N \frac{(y_i - f(\vec{x_i}))^2}{\sigma_{y_i}^2} \]
Definition at line 21 of file Chi2FitFigureOfMerit.h.
Chi2FitFigureOfMerit::Chi2FitFigureOfMerit | ( | ) |
Default Constructor
Definition at line 8 of file Chi2FitFigureOfMerit.cxx.
Chi2FitFigureOfMerit::~Chi2FitFigureOfMerit | ( | ) |
Destructor
Definition at line 14 of file Chi2FitFigureOfMerit.cxx.
void Chi2FitFigureOfMerit::addData | ( | const std::vector< double > & | x, |
double | y, | ||
double | ey | ||
) |
Adds a data point
x | \(\vec{x}\) coordinate. |
y | \(y\) coordinate. |
ey | \(\sigma_y\) error on \(y\) coordinate. |
Definition at line 23 of file Chi2FitFigureOfMerit.cxx.
void Chi2FitFigureOfMerit::clearData | ( | ) |
Clear all data
Definition at line 30 of file Chi2FitFigureOfMerit.cxx.
|
virtual |
Compute the score ( \(\chi^2/ndf\)) for a given model relative to the data points.
imodel | Model to be evaluated. |
The \(\chi^2/ndf\) score is then defined as:
\[ \chi^2/ndf = \frac{1}{N}\sum_{i=0}^N \frac{(y_i - f(\vec{x_i}))^2}{\sigma_{y_i}^2} \]
Implements IFigureOfMerit.
Definition at line 46 of file Chi2FitFigureOfMerit.cxx.
|
virtual |
Compares two score values
scoreToTest | Score value to be tested. |
referenceScore | Score value to be compared to. |
Reimplemented from IFigureOfMerit.
Definition at line 76 of file Chi2FitFigureOfMerit.cxx.