Implements a mixture model of the inverse gumbel and the gauss distribution or a gaussian mixture. More...
#include <OpenMS/MATH/STATISTICS/PosteriorErrorProbabilityModel.h>
Public Member Functions | |
PosteriorErrorProbabilityModel () | |
default constructor More... | |
virtual | ~PosteriorErrorProbabilityModel () |
Destructor. More... | |
bool | fit (std::vector< double > &search_engine_scores) |
fits the distributions to the data points(search_engine_scores). Estimated parameters for the distributions are saved in member variables. computeProbability can be used afterwards. More... | |
bool | fit (std::vector< double > &search_engine_scores, std::vector< double > &probabilities) |
fits the distributions to the data points(search_engine_scores) and writes the computed probabilities into the given vector (the second one). More... | |
void | fillDensities (std::vector< double > &x_scores, std::vector< double > &incorrect_density, std::vector< double > &correct_density) |
Writes the distributions densities into the two vectors for a set of scores. Incorrect_densities represent the incorrectly assigned sequences. More... | |
double | computeMaxLikelihood (std::vector< double > &incorrect_density, std::vector< double > &correct_density) |
computes the Maximum Likelihood with a log-likelihood function. More... | |
double | one_minus_sum_post (std::vector< double > &incorrect_density, std::vector< double > &correct_density) |
sums (1 - posterior probabilities) More... | |
double | sum_post (std::vector< double > &incorrect_density, std::vector< double > &correct_density) |
sums posterior probabilities More... | |
double | sum_pos_x0 (std::vector< double > &x_scores, std::vector< double > &incorrect_density, std::vector< double > &correct_density) |
helper function for the EM algorithm (for fitting) More... | |
double | sum_neg_x0 (std::vector< double > &x_scores, std::vector< double > &incorrect_density, std::vector< double > &correct_density) |
helper function for the EM algorithm (for fitting) More... | |
double | sum_pos_sigma (std::vector< double > &x_scores, std::vector< double > &incorrect_density, std::vector< double > &correct_density, double positive_mean) |
helper function for the EM algorithm (for fitting) More... | |
double | sum_neg_sigma (std::vector< double > &x_scores, std::vector< double > &incorrect_density, std::vector< double > &correct_density, double positive_mean) |
helper function for the EM algorithm (for fitting) More... | |
GaussFitter::GaussFitResult | getCorrectlyAssignedFitResult () const |
returns estimated parameters for correctly assigned sequences. Fit should be used before. More... | |
GaussFitter::GaussFitResult | getIncorrectlyAssignedFitResult () const |
returns estimated parameters for correctly assigned sequences. Fit should be used before. More... | |
double | getNegativePrior () const |
returns the estimated negative prior probability. More... | |
double | getGauss (double x, const GaussFitter::GaussFitResult ¶ms) |
computes the gaussian density at position x with parameters params. More... | |
double | getGumbel (double x, const GaussFitter::GaussFitResult ¶ms) |
computes the gumbel density at position x with parameters params. More... | |
double | computeProbability (double score) |
TextFile | initPlots (std::vector< double > &x_scores) |
initializes the plots More... | |
const String | getGumbelGnuplotFormula (const GaussFitter::GaussFitResult ¶ms) const |
returns the gnuplot formula of the fitted gumbel distribution. Only x0 and sigma are used as local parameter alpha and scale parameter beta, respectively. More... | |
const String | getGaussGnuplotFormula (const GaussFitter::GaussFitResult ¶ms) const |
returns the gnuplot formula of the fitted gauss distribution. More... | |
const String | getBothGnuplotFormula (const GaussFitter::GaussFitResult &incorrect, const GaussFitter::GaussFitResult &correct) const |
returns the gnuplot formula of the fitted mixture distribution. More... | |
void | plotTargetDecoyEstimation (std::vector< double > &target, std::vector< double > &decoy) |
plots the estimated distribution against target and decoy hits More... | |
double | getSmallestScore () |
returns the smallest score used in the last fit More... | |
void | tryGnuplot (const String &gp_file) |
try to invoke 'gnuplot' on the file to create PDF automatically More... | |
Public Member Functions inherited from DefaultParamHandler | |
DefaultParamHandler (const String &name) | |
Constructor with name that is displayed in error messages. More... | |
DefaultParamHandler (const DefaultParamHandler &rhs) | |
Copy constructor. More... | |
virtual | ~DefaultParamHandler () |
Destructor. More... | |
virtual DefaultParamHandler & | operator= (const DefaultParamHandler &rhs) |
Assignment operator. More... | |
virtual bool | operator== (const DefaultParamHandler &rhs) const |
Equality operator. More... | |
void | setParameters (const Param ¶m) |
Sets the parameters. More... | |
const Param & | getParameters () const |
Non-mutable access to the parameters. More... | |
const Param & | getDefaults () const |
Non-mutable access to the default parameters. More... | |
const String & | getName () const |
Non-mutable access to the name. More... | |
void | setName (const String &name) |
Mutable access to the name. More... | |
const std::vector< String > & | getSubsections () const |
Non-mutable access to the registered subsections. More... | |
Private Member Functions | |
PosteriorErrorProbabilityModel & | operator= (const PosteriorErrorProbabilityModel &rhs) |
assignment operator (not implemented) More... | |
PosteriorErrorProbabilityModel (const PosteriorErrorProbabilityModel &rhs) | |
Copy constructor (not implemented) More... | |
Private Attributes | |
GaussFitter::GaussFitResult | incorrectly_assigned_fit_param_ |
stores parameters for incorrectly assigned sequences. If gumbel fit was used, A can be ignored. Furthermore, in this case, x0 and sigma are the local parameter alpha and scale parameter beta, respectively. More... | |
GaussFitter::GaussFitResult | correctly_assigned_fit_param_ |
stores gauss parameters More... | |
double | negative_prior_ |
stores final prior probability for negative peptides More... | |
double | max_incorrectly_ |
peak of the incorrectly assigned sequences distribution More... | |
double | max_correctly_ |
peak of the gauss distribution (correctly assigned sequences) More... | |
double | smallest_score_ |
smallest score which was used for fitting the model More... | |
double(PosteriorErrorProbabilityModel::* | calc_incorrect_ )(double x, const GaussFitter::GaussFitResult ¶ms) |
points to getGauss More... | |
double(PosteriorErrorProbabilityModel::* | calc_correct_ )(double x, const GaussFitter::GaussFitResult ¶ms) |
points either to getGumbel or getGauss depending on whether one uses the gumbel or the gaussian distribution for incorrectly assigned sequences. More... | |
const String(PosteriorErrorProbabilityModel::* | getNegativeGnuplotFormula_ )(const GaussFitter::GaussFitResult ¶ms) const |
points either to getGumbelGnuplotFormula or getGaussGnuplotFormula depending on whether one uses the gumbel or the gaussian distribution for incorrectly assigned sequences. More... | |
const String(PosteriorErrorProbabilityModel::* | getPositiveGnuplotFormula_ )(const GaussFitter::GaussFitResult ¶ms) const |
points to getGumbelGnuplotFormula More... | |
Additional Inherited Members | |
Protected Member Functions inherited from DefaultParamHandler | |
virtual void | updateMembers_ () |
This method is used to update extra member variables at the end of the setParameters() method. More... | |
void | defaultsToParam_ () |
Updates the parameters after the defaults have been set in the constructor. More... | |
Protected Attributes inherited from DefaultParamHandler | |
Param | param_ |
Container for current parameters. More... | |
Param | defaults_ |
Container for default parameters. This member should be filled in the constructor of derived classes! More... | |
std::vector< String > | subsections_ |
Container for registered subsections. This member should be filled in the constructor of derived classes! More... | |
String | error_name_ |
Name that is displayed in error messages during the parameter checking. More... | |
bool | check_defaults_ |
If this member is set to false no checking if parameters in done;. More... | |
bool | warn_empty_defaults_ |
If this member is set to false no warning is emitted when defaults are empty;. More... | |
Implements a mixture model of the inverse gumbel and the gauss distribution or a gaussian mixture.
This class fits either a Gumbel distribution and a Gauss distribution to a set of data points or two Gaussian distributions using the EM algorithm. One can output the fit as a gnuplot formula using getGumbelGnuplotFormula() and getGaussGnuplotFormula() after fitting.
Name | Type | Default | Restrictions | Description |
---|---|---|---|---|
out_plot | string | If given, the some output files will be saved in the following manner: |
||
number_of_bins | int | 100 | Number of bins used for visualization. Only needed if each iteration step of the EM-Algorithm will be visualized | |
incorrectly_assigned | string | Gumbel | Gumbel, Gauss | for 'Gumbel', the Gumbel distribution is used to plot incorrectly assigned sequences. For 'Gauss', the Gauss distribution is used. |
max_nr_iterations | int | 1000 | Bounds the number of iterations for the EM algorithm when convergence is slow. |
default constructor
|
virtual |
Destructor.
|
private |
Copy constructor (not implemented)
double computeMaxLikelihood | ( | std::vector< double > & | incorrect_density, |
std::vector< double > & | correct_density | ||
) |
computes the Maximum Likelihood with a log-likelihood function.
Returns the computed posterior error probability for a given score.
void fillDensities | ( | std::vector< double > & | x_scores, |
std::vector< double > & | incorrect_density, | ||
std::vector< double > & | correct_density | ||
) |
Writes the distributions densities into the two vectors for a set of scores. Incorrect_densities represent the incorrectly assigned sequences.
bool fit | ( | std::vector< double > & | search_engine_scores | ) |
fits the distributions to the data points(search_engine_scores). Estimated parameters for the distributions are saved in member variables. computeProbability can be used afterwards.
search_engine_scores | a vector which holds the data points |
fits the distributions to the data points(search_engine_scores) and writes the computed probabilities into the given vector (the second one).
search_engine_scores | a vector which holds the data points |
probabilities | a vector which holds the probability for each data point after running this function. If it has some content it will be overwritten. |
const String getBothGnuplotFormula | ( | const GaussFitter::GaussFitResult & | incorrect, |
const GaussFitter::GaussFitResult & | correct | ||
) | const |
returns the gnuplot formula of the fitted mixture distribution.
|
inline |
returns estimated parameters for correctly assigned sequences. Fit should be used before.
|
inline |
computes the gaussian density at position x with parameters params.
References GaussFitter::GaussFitResult::A, GaussFitter::GaussFitResult::sigma, and GaussFitter::GaussFitResult::x0.
const String getGaussGnuplotFormula | ( | const GaussFitter::GaussFitResult & | params | ) | const |
returns the gnuplot formula of the fitted gauss distribution.
|
inline |
computes the gumbel density at position x with parameters params.
References GaussFitter::GaussFitResult::sigma, and GaussFitter::GaussFitResult::x0.
const String getGumbelGnuplotFormula | ( | const GaussFitter::GaussFitResult & | params | ) | const |
returns the gnuplot formula of the fitted gumbel distribution. Only x0 and sigma are used as local parameter alpha and scale parameter beta, respectively.
|
inline |
returns estimated parameters for correctly assigned sequences. Fit should be used before.
|
inline |
returns the estimated negative prior probability.
|
inline |
returns the smallest score used in the last fit
double one_minus_sum_post | ( | std::vector< double > & | incorrect_density, |
std::vector< double > & | correct_density | ||
) |
sums (1 - posterior probabilities)
|
private |
assignment operator (not implemented)
plots the estimated distribution against target and decoy hits
double sum_neg_sigma | ( | std::vector< double > & | x_scores, |
std::vector< double > & | incorrect_density, | ||
std::vector< double > & | correct_density, | ||
double | positive_mean | ||
) |
helper function for the EM algorithm (for fitting)
double sum_neg_x0 | ( | std::vector< double > & | x_scores, |
std::vector< double > & | incorrect_density, | ||
std::vector< double > & | correct_density | ||
) |
helper function for the EM algorithm (for fitting)
double sum_pos_sigma | ( | std::vector< double > & | x_scores, |
std::vector< double > & | incorrect_density, | ||
std::vector< double > & | correct_density, | ||
double | positive_mean | ||
) |
helper function for the EM algorithm (for fitting)
double sum_pos_x0 | ( | std::vector< double > & | x_scores, |
std::vector< double > & | incorrect_density, | ||
std::vector< double > & | correct_density | ||
) |
helper function for the EM algorithm (for fitting)
double sum_post | ( | std::vector< double > & | incorrect_density, |
std::vector< double > & | correct_density | ||
) |
sums posterior probabilities
void tryGnuplot | ( | const String & | gp_file | ) |
try to invoke 'gnuplot' on the file to create PDF automatically
|
private |
points either to getGumbel or getGauss depending on whether one uses the gumbel or the gaussian distribution for incorrectly assigned sequences.
|
private |
points to getGauss
|
private |
stores gauss parameters
|
private |
points either to getGumbelGnuplotFormula or getGaussGnuplotFormula depending on whether one uses the gumbel or the gaussian distribution for incorrectly assigned sequences.
|
private |
points to getGumbelGnuplotFormula
|
private |
stores parameters for incorrectly assigned sequences. If gumbel fit was used, A can be ignored. Furthermore, in this case, x0 and sigma are the local parameter alpha and scale parameter beta, respectively.
|
private |
peak of the gauss distribution (correctly assigned sequences)
|
private |
peak of the incorrectly assigned sequences distribution
|
private |
stores final prior probability for negative peptides
|
private |
smallest score which was used for fitting the model
OpenMS / TOPP release 2.3.0 | Documentation generated on Tue Jan 9 2018 18:22:15 using doxygen 1.8.13 |