1%feature("docstring") OT::MaximumLikelihoodFactory 2"Maximum likelihood factory. 3 4Refer to :ref:`maximum_likelihood`. 5 6Parameters 7---------- 8distribution : :class:`~openturns.Distribution` 9 The distribution defining the parametric model :math:`p_{\vect{\theta}}` to be adjusted to data. 10 11Notes 12----- 13Implements generic maximum likelihood estimation. 14 15Let us denote :math:`(\vect{x}_1, \dots, \vect{x}_n)` the sample, :math:`p_{\vect{\theta}}` 16the particular distribution of probability density function we want to fit to the sample, 17and :math:`\vect{\theta} \in \Theta \in \Rset^p` its the parameter vector. 18 19 20The likelihood of the sample according to :math:`p_{\vect{\theta}}` is: 21 22.. math:: 23 24 likelihood(\vect{x}_1, \dots, \vect{x}_n,\vect{\theta}) = \prod_{i=1}^n p_{\vect{\theta}}(\vect{x}_i) 25 26The parameters :math:`\vect{\theta}` are numerically optimized using an optimization algorithm: 27 28.. math:: 29 30 \max_{\vect{\theta} \in \Theta} \log likelihood\, (\vect{x}_1, \dots, \vect{x}_n,\vect{\theta}) = \max_{\vect{\theta} \in \Theta} \sum_{i=1}^n log(p_{\vect{\theta}}(\vect{x}_i)) 31 32See also 33-------- 34DistributionFactory 35 36Examples 37-------- 38 39In the following example, we estimate the parameters of a `Normal` distribution 40with maximum likelihood estimation. 41 42>>> import openturns as ot 43>>> ot.RandomGenerator.SetSeed(0) 44>>> distribution = ot.Normal(0.9, 1.7) 45>>> sample = distribution.getSample(10) 46>>> factory = ot.MaximumLikelihoodFactory(ot.Normal()) 47>>> inf_distribution = factory.build(sample)" 48 49// --------------------------------------------------------------------- 50 51%feature("docstring") OT::MaximumLikelihoodFactory::setOptimizationAlgorithm 52"Accessor to the solver. 53 54Parameters 55---------- 56solver : :class:`~openturns.OptimizationAlgorithm` 57 The solver used for numerical optimization of the likelihood." 58 59// --------------------------------------------------------------------- 60 61%feature("docstring") OT::MaximumLikelihoodFactory::getOptimizationAlgorithm 62"Accessor to the solver. 63 64Returns 65------- 66solver : :class:`~openturns.OptimizationAlgorithm` 67 The solver used for numerical optimization of the likelihood." 68 69// --------------------------------------------------------------------- 70 71%feature("docstring") OT::MaximumLikelihoodFactory::setOptimizationBounds 72"Accessor to the optimization bounds. 73 74Parameters 75---------- 76bounds : :class:`~openturns.Interval` 77 The bounds used for numerical optimization of the likelihood." 78 79// --------------------------------------------------------------------- 80 81%feature("docstring") OT::MaximumLikelihoodFactory::getOptimizationBounds 82"Accessor to the optimization bounds. 83 84Returns 85------- 86bounds : :class:`~openturns.Interval` 87 The bounds used for numerical optimization of the likelihood." 88 89// --------------------------------------------------------------------- 90 91%feature("docstring") OT::MaximumLikelihoodFactory::setOptimizationInequalityConstraint 92"Accessor to the optimization inequality constraint. 93 94Parameters 95---------- 96inequalityConstraint : :class:`~openturns.Function` 97 The inequality constraint used for numerical optimization of the likelihood." 98 99// --------------------------------------------------------------------- 100 101%feature("docstring") OT::MaximumLikelihoodFactory::setKnownParameter 102"Accessor to the known parameters. 103 104Parameters 105---------- 106values : sequence of float 107 Values of fixed parameters. 108positions : sequence of int 109 Indices of fixed parameters. 110 111Examples 112-------- 113There are situations where a subset of the parameters is known. 114In this case, only the other parameters must be estimated 115from data. 116 117In the following example, we consider a sample and want to fit 118a :class:`~openturns.Beta` distribution. 119We assume that the :math:`a` and :math:`b` parameters are known beforehand. 120In this case, we set the third parameter (at index 2) to -1 121and the fourth parameter (at index 3) to 1. 122 123>>> import openturns as ot 124>>> ot.RandomGenerator.SetSeed(0) 125>>> distribution = ot.Beta(2.3, 2.2, -1.0, 1.0) 126>>> sample = distribution.getSample(10) 127>>> factory = ot.MaximumLikelihoodFactory(ot.Beta()) 128>>> # set (a,b) out of (r, t, a, b) 129>>> factory.setKnownParameter([-1.0, 1.0], [2, 3]) 130>>> inf_distribution = factory.build(sample)" 131 132// --------------------------------------------------------------------- 133 134%feature("docstring") OT::MaximumLikelihoodFactory::getKnownParameterValues 135"Accessor to the known parameters indices. 136 137Returns 138------- 139values : :class:`~openturns.Point` 140 Values of fixed parameters." 141 142// --------------------------------------------------------------------- 143 144%feature("docstring") OT::MaximumLikelihoodFactory::getKnownParameterIndices 145"Accessor to the known parameters indices. 146 147Returns 148------- 149indices : :class:`~openturns.Indices` 150 Indices of fixed parameters." 151