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 | |
| virtual | ~PosteriorErrorProbabilityModel () |
| Destructor. | |
| 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. | |
| 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 probabilites into the given vector (the second one). | |
| void | fillDensities (std::vector< double > &x_scores, std::vector< DoubleReal > &incorrect_density, std::vector< DoubleReal > &correct_density) |
| Writes the distributions densities into the two vectors for a set of scores. Incorrect_densities represent the incorreclty assigned seqeuences. | |
| DoubleReal | computeMaxLikelihood (std::vector< DoubleReal > &incorrect_density, std::vector< DoubleReal > &correct_density) |
| computes the Maximum Likelihood with a log-likelihood funciotn. | |
| DoubleReal | one_minus_sum_post (std::vector< DoubleReal > &incorrect_density, std::vector< DoubleReal > &correct_density) |
| sums (1 - posterior porbabilities) | |
| DoubleReal | sum_post (std::vector< DoubleReal > &incorrect_density, std::vector< DoubleReal > &correct_density) |
| sums posterior porbabilities | |
| DoubleReal | sum_pos_x0 (std::vector< double > &x_scores, std::vector< DoubleReal > &incorrect_density, std::vector< DoubleReal > &correct_density) |
| helper function for the EM algorithm (for fitting) | |
| DoubleReal | sum_neg_x0 (std::vector< double > &x_scores, std::vector< DoubleReal > &incorrect_density, std::vector< DoubleReal > &correct_density) |
| helper function for the EM algorithm (for fitting) | |
| DoubleReal | sum_pos_sigma (std::vector< double > &x_scores, std::vector< DoubleReal > &incorrect_density, std::vector< DoubleReal > &correct_density, DoubleReal positive_mean) |
| helper function for the EM algorithm (for fitting) | |
| DoubleReal | sum_neg_sigma (std::vector< double > &x_scores, std::vector< DoubleReal > &incorrect_density, std::vector< DoubleReal > &correct_density, DoubleReal positive_mean) |
| helper function for the EM algorithm (for fitting) | |
| GaussFitter::GaussFitResult | getCorrectlyAssignedFitResult () const |
| returns estimated parameters for correctly assigned sequences. Fit should be used before. | |
| GaussFitter::GaussFitResult | getIncorrectlyAssignedFitResult () const |
| returns estimated parameters for correctly assigned sequences. Fit should be used before. | |
| DoubleReal | getNegativePrior () const |
| returns the estimated negative prior probability. | |
| DoubleReal | getGauss (DoubleReal x, const GaussFitter::GaussFitResult ¶ms) |
| computes the gaussian density at position x with parameters params. | |
| DoubleReal | getGumbel (DoubleReal x, const GaussFitter::GaussFitResult ¶ms) |
| computes the gumbel density at position x with parameters params. | |
| DoubleReal | computeProbability (DoubleReal score) |
| TextFile * | InitPlots (std::vector< double > &x_scores) |
| initializes the plots | |
| 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. | |
| const String | getGaussGnuplotFormula (const GaussFitter::GaussFitResult ¶ms) const |
| returns the gnuplot formula of the fitted gauss distribution. | |
| const String | getBothGnuplotFormula (const GaussFitter::GaussFitResult &incorrect, const GaussFitter::GaussFitResult &correct) const |
| returns the gnuplot formula of the fitted mixture distribution. | |
| void | plotTargetDecoyEstimation (std::vector< double > &target, std::vector< double > &decoy) |
| plots the estimated distribution against target and decoy hits | |
| DoubleReal | getSmallestScore () |
| returns the smallest score used in the last fit | |
Private Member Functions | |
| PosteriorErrorProbabilityModel & | operator= (const PosteriorErrorProbabilityModel &rhs) |
| assignment operator (not implemented) | |
| PosteriorErrorProbabilityModel (const PosteriorErrorProbabilityModel &rhs) | |
| Copy constructor (not implemented). | |
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. | |
| GaussFitter::GaussFitResult | correctly_assigned_fit_param_ |
| stores gauss parameters | |
| DoubleReal | negative_prior_ |
| stores final prior probability for negative peptides | |
| DoubleReal | max_incorrectly_ |
| peak of the incorrectly assigned sequences distribution | |
| DoubleReal | max_correctly_ |
| peak of the gauss distribution (correctly assigned sequences) | |
| DoubleReal | smallest_score_ |
| smallest score which was used for fitting the model | |
| DoubleReal(PosteriorErrorProbabilityModel::* | calc_incorrect_ )(DoubleReal x, const GaussFitter::GaussFitResult ¶ms) |
| points to getGauss | |
| DoubleReal(PosteriorErrorProbabilityModel::* | calc_correct_ )(DoubleReal x, const GaussFitter::GaussFitResult ¶ms) |
| points either to getGumbel or getGauss depending on whether on uses the gumbel or th gausian distribution for incorrectly assigned sequences. | |
| const String(PosteriorErrorProbabilityModel::* | getNegativeGnuplotFormula_ )(const GaussFitter::GaussFitResult ¶ms) const |
| points either to getGumbelGnuplotFormula or getGaussGnuplotFormula depending on whether on uses the gumbel or th gausian distribution for incorrectly assigned sequences. | |
| const String(PosteriorErrorProbabilityModel::* | getPositiveGnuplotFormula_ )(const GaussFitter::GaussFitResult ¶ms) const |
| points to getGumbelGnuplotFormula | |
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 |
|---|---|---|---|---|
| number_of_bins | int | 100 | Number of bins used for visualization. Only needed if each iteration step of the EM-Algorithm will be visualized | |
| output_plots | string | false | true, false | If true every step of the EM-algorithm will be written to a file as a gnuplot formula |
| output_name | string | If output_plots is on, the output files will be saved in the following manner: |
||
| 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. |
default constructor
| virtual ~PosteriorErrorProbabilityModel | ( | ) | [virtual] |
Destructor.
| PosteriorErrorProbabilityModel | ( | const PosteriorErrorProbabilityModel & | rhs | ) | [private] |
Copy constructor (not implemented).
| DoubleReal computeMaxLikelihood | ( | std::vector< DoubleReal > & | incorrect_density, | |
| std::vector< DoubleReal > & | correct_density | |||
| ) |
computes the Maximum Likelihood with a log-likelihood funciotn.
| DoubleReal computeProbability | ( | DoubleReal | score | ) |
Returns the computed posterior error probability for a given score.
| void fillDensities | ( | std::vector< double > & | x_scores, | |
| std::vector< DoubleReal > & | incorrect_density, | |||
| std::vector< DoubleReal > & | correct_density | |||
| ) |
Writes the distributions densities into the two vectors for a set of scores. Incorrect_densities represent the incorreclty assigned seqeuences.
fits the distributions to the data points(search_engine_scores) and writes the computed probabilites 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. |
| 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 |
| const String getBothGnuplotFormula | ( | const GaussFitter::GaussFitResult & | incorrect, | |
| const GaussFitter::GaussFitResult & | correct | |||
| ) | const |
returns the gnuplot formula of the fitted mixture distribution.
| GaussFitter::GaussFitResult getCorrectlyAssignedFitResult | ( | ) | const [inline] |
returns estimated parameters for correctly assigned sequences. Fit should be used before.
| DoubleReal getGauss | ( | DoubleReal | x, | |
| const GaussFitter::GaussFitResult & | params | |||
| ) | [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.
| DoubleReal getGumbel | ( | DoubleReal | x, | |
| const GaussFitter::GaussFitResult & | params | |||
| ) | [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.
| GaussFitter::GaussFitResult getIncorrectlyAssignedFitResult | ( | ) | const [inline] |
returns estimated parameters for correctly assigned sequences. Fit should be used before.
| DoubleReal getNegativePrior | ( | ) | const [inline] |
returns the estimated negative prior probability.
| DoubleReal getSmallestScore | ( | ) | [inline] |
returns the smallest score used in the last fit
| DoubleReal one_minus_sum_post | ( | std::vector< DoubleReal > & | incorrect_density, | |
| std::vector< DoubleReal > & | correct_density | |||
| ) |
sums (1 - posterior porbabilities)
| PosteriorErrorProbabilityModel& operator= | ( | const PosteriorErrorProbabilityModel & | rhs | ) | [private] |
assignment operator (not implemented)
plots the estimated distribution against target and decoy hits
| DoubleReal sum_neg_sigma | ( | std::vector< double > & | x_scores, | |
| std::vector< DoubleReal > & | incorrect_density, | |||
| std::vector< DoubleReal > & | correct_density, | |||
| DoubleReal | positive_mean | |||
| ) |
helper function for the EM algorithm (for fitting)
| DoubleReal sum_neg_x0 | ( | std::vector< double > & | x_scores, | |
| std::vector< DoubleReal > & | incorrect_density, | |||
| std::vector< DoubleReal > & | correct_density | |||
| ) |
helper function for the EM algorithm (for fitting)
| DoubleReal sum_pos_sigma | ( | std::vector< double > & | x_scores, | |
| std::vector< DoubleReal > & | incorrect_density, | |||
| std::vector< DoubleReal > & | correct_density, | |||
| DoubleReal | positive_mean | |||
| ) |
helper function for the EM algorithm (for fitting)
| DoubleReal sum_pos_x0 | ( | std::vector< double > & | x_scores, | |
| std::vector< DoubleReal > & | incorrect_density, | |||
| std::vector< DoubleReal > & | correct_density | |||
| ) |
helper function for the EM algorithm (for fitting)
| DoubleReal sum_post | ( | std::vector< DoubleReal > & | incorrect_density, | |
| std::vector< DoubleReal > & | correct_density | |||
| ) |
sums posterior porbabilities
DoubleReal(PosteriorErrorProbabilityModel::* calc_correct_)(DoubleReal x, const GaussFitter::GaussFitResult ¶ms) [private] |
points either to getGumbel or getGauss depending on whether on uses the gumbel or th gausian distribution for incorrectly assigned sequences.
DoubleReal(PosteriorErrorProbabilityModel::* calc_incorrect_)(DoubleReal x, const GaussFitter::GaussFitResult ¶ms) [private] |
points to getGauss
stores gauss parameters
const String(PosteriorErrorProbabilityModel::* getNegativeGnuplotFormula_)(const GaussFitter::GaussFitResult ¶ms) const [private] |
points either to getGumbelGnuplotFormula or getGaussGnuplotFormula depending on whether on uses the gumbel or th gausian distribution for incorrectly assigned sequences.
const String(PosteriorErrorProbabilityModel::* getPositiveGnuplotFormula_)(const GaussFitter::GaussFitResult ¶ms) const [private] |
points to getGumbelGnuplotFormula
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.
DoubleReal max_correctly_ [private] |
peak of the gauss distribution (correctly assigned sequences)
DoubleReal max_incorrectly_ [private] |
peak of the incorrectly assigned sequences distribution
DoubleReal negative_prior_ [private] |
stores final prior probability for negative peptides
DoubleReal smallest_score_ [private] |
smallest score which was used for fitting the model
| OpenMS / TOPP release 1.10.0 | Documentation generated on Thu Mar 7 2013 09:43:00 using doxygen 1.7.1 |