Package com.irurueta.numerical
Class AccurateMaximumLikelihoodEstimator
java.lang.Object
com.irurueta.numerical.MaximumLikelihoodEstimator
com.irurueta.numerical.AccurateMaximumLikelihoodEstimator
Class to estimate the most likely value from a series of samples assumed to
be normally distributed.
This implementation will first use an internal HistogramMaximumLikelihood
to estimate the most likely value using a histogram, and then it will
refine the solution by using a BrentSingleOptimizer in order to find the
maximum of the probability distribution function assuming that such function
is computed by aggregating small Gaussians (of size gaussianSigma) centered
at the location of each sample.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
Internal class used by the BrentSingleOptimizer in order to evaluate the aggregation of Gaussians for all the samples in input data array with a high degree of precision. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean
Boolean indicating if an initial solution should be obtained first by using the Histogram method.static final double
Value to be considered as the machine precision.Internal maximum likelihood estimator based on the Histogram method.private BrentSingleOptimizer
Internal optimizer to find the true maximum of the probability distribution function.private boolean
Boolean that indicates that an initial coarse solution will be computed first by using an internal HistogramMaximumLikelihoodEstimator in order to initialize the internal BrentSingleOptimizer to obtain a more accurate solution.Fields inherited from class com.irurueta.numerical.MaximumLikelihoodEstimator
areMinMaxAvailable, DEFAULT_GAUSSIAN_SIGMA, DEFAULT_METHOD, gaussianSigma, inputData, locked, maxValue, MIN_GAUSSIAN_SIGMA, minValue
-
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor.AccurateMaximumLikelihoodEstimator
(double[] inputData, double gaussianSigma, boolean useHistogramInitialSolution) ConstructorAccurateMaximumLikelihoodEstimator
(double gaussianSigma, boolean useHistogramInitialSolution) Constructor.AccurateMaximumLikelihoodEstimator
(double minValue, double maxValue, double[] inputData, double gaussianSigma, boolean useHistogramInitialSolution) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondouble
estimate()
Starts the estimation of the most likely value contained within provided input data array.Returns method to be used for maximum likelihood estimation, which for this class is MaximumLikelihoodEstimatorMethod.boolean
Returns boolean that indicates that an initial coarse solution will be computed first by using an internal HistogramMaximumLikelihoodEstimator in order to initialize the internal BrentSingleOptimizer to obtain a more accurate solution.void
setHistogramInitialSolutionUsed
(boolean used) Sets boolean that indicates that an initial coarse solution will be computed first by using an internal HistogramMaximumLikelihoodEstimator in order to initialize the internal BrentSingleOptimizer to obtain a more accurate solution.Methods inherited from class com.irurueta.numerical.MaximumLikelihoodEstimator
areMinMaxValuesAvailable, computeMinMaxValues, create, create, create, create, create, create, create, create, create, getGaussianSigma, getInputData, getMaxValue, getMinValue, isInputDataAvailable, isLocked, isReady, setGaussianSigma, setInputData, setInputData, setMinMaxValues
-
Field Details
-
DEFAULT_USE_HISTOGRAM_INITIAL_SOLUTION
public static final boolean DEFAULT_USE_HISTOGRAM_INITIAL_SOLUTIONBoolean indicating if an initial solution should be obtained first by using the Histogram method. It is suggested to always enable this option.- See Also:
-
EPS
public static final double EPSValue to be considered as the machine precision.- See Also:
-
useHistogramInitialSolution
private boolean useHistogramInitialSolutionBoolean that indicates that an initial coarse solution will be computed first by using an internal HistogramMaximumLikelihoodEstimator in order to initialize the internal BrentSingleOptimizer to obtain a more accurate solution. -
internalEstimator
Internal maximum likelihood estimator based on the Histogram method. -
optimizer
Internal optimizer to find the true maximum of the probability distribution function. Because a BrentSingleOptimizer is only guaranteed to obtain local minima/maxima, it is preferred to start the optimizer near the true solution to be found, for that reason it is suggested to always use the Histogram initial solution as coarse approximation to start the optimizer and get a more accurate solution.
-
-
Constructor Details
-
AccurateMaximumLikelihoodEstimator
public AccurateMaximumLikelihoodEstimator(double gaussianSigma, boolean useHistogramInitialSolution) Constructor.- Parameters:
gaussianSigma
- Gaussian sigma to be used on each sample.useHistogramInitialSolution
- Boolean indicating whether an internal HistogramMaximumLikelihoodEstimator will be used to obtain a coarse initial solution to initialize the BrentSingleOptimizer. It is suggested to set this value always to true.- Throws:
IllegalArgumentException
- Raised if provided Gaussian sigma is negative or zero.
-
AccurateMaximumLikelihoodEstimator
public AccurateMaximumLikelihoodEstimator()Empty constructor. -
AccurateMaximumLikelihoodEstimator
public AccurateMaximumLikelihoodEstimator(double[] inputData, double gaussianSigma, boolean useHistogramInitialSolution) Constructor- Parameters:
inputData
- Array containing input data where most likely value must be estimated from.gaussianSigma
- Gaussian sigma to be used on each sample.useHistogramInitialSolution
- Boolean indicating whether an internal HistogramMaximumLikelihoodEstimator will be used to obtain a coarse initial solution to initialize the BrentSingleOptimizer. It is suggested to set this value always to true.- Throws:
IllegalArgumentException
- Raised if provided Gaussian sigma is negative or zero.
-
AccurateMaximumLikelihoodEstimator
public AccurateMaximumLikelihoodEstimator(double minValue, double maxValue, double[] inputData, double gaussianSigma, boolean useHistogramInitialSolution) Constructor.- Parameters:
minValue
- Minimum value assumed to be contained within input data array.maxValue
- Maximum value assumed to be contained within input data array.inputData
- Array containing input data where most likely value must be estimated from.gaussianSigma
- Gaussian sigma to be used on each sample.useHistogramInitialSolution
- Boolean indicating whether an internal HistogramMaximumLikelihoodEstimator will be used to obtain a coarse initial solution to initialize the BrentSingleOptimizer. It is suggested to set this value always to true.- Throws:
IllegalArgumentException
- Raised if provided Gaussian sigma is negative or zero, or if minValue < maxValue.
-
-
Method Details
-
getMethod
Returns method to be used for maximum likelihood estimation, which for this class is MaximumLikelihoodEstimatorMethod. ACCURATE_MAXIMUM_LIKELIHOOD_ESTIMATOR.- Specified by:
getMethod
in classMaximumLikelihoodEstimator
- Returns:
- Method for maximum likelihood estimation.
-
isHistogramInitialSolutionUsed
public boolean isHistogramInitialSolutionUsed()Returns boolean that indicates that an initial coarse solution will be computed first by using an internal HistogramMaximumLikelihoodEstimator in order to initialize the internal BrentSingleOptimizer to obtain a more accurate solution.- Returns:
- True if an initial coarse solution if found by the Histogram method, false otherwise.
-
setHistogramInitialSolutionUsed
Sets boolean that indicates that an initial coarse solution will be computed first by using an internal HistogramMaximumLikelihoodEstimator in order to initialize the internal BrentSingleOptimizer to obtain a more accurate solution.- Parameters:
used
- True if an initial coarse solution will be found by the Histogram method, false otherwise.- Throws:
LockedException
- Exception raised if this instance is locked. This method can only be executed when computations finish and this instance becomes unlocked.
-
estimate
Starts the estimation of the most likely value contained within provided input data array.- Specified by:
estimate
in classMaximumLikelihoodEstimator
- Returns:
- The most likely value.
- Throws:
LockedException
- Exception raised if this instance is locked. This method can only be executed when computations finish and this instance becomes unlocked.NotReadyException
- Exception raised if this instance is not yet ready.- See Also:
-