Class AccurateMaximumLikelihoodEstimator

java.lang.Object
com.irurueta.numerical.MaximumLikelihoodEstimator
com.irurueta.numerical.AccurateMaximumLikelihoodEstimator

public class AccurateMaximumLikelihoodEstimator extends MaximumLikelihoodEstimator
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.
  • Field Details

    • DEFAULT_USE_HISTOGRAM_INITIAL_SOLUTION

      public static final boolean DEFAULT_USE_HISTOGRAM_INITIAL_SOLUTION
      Boolean 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 EPS
      Value to be considered as the machine precision.
      See Also:
    • useHistogramInitialSolution

      private boolean useHistogramInitialSolution
      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.
    • internalEstimator

      private HistogramMaximumLikelihoodEstimator internalEstimator
      Internal maximum likelihood estimator based on the Histogram method.
    • optimizer

      private BrentSingleOptimizer 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 class MaximumLikelihoodEstimator
      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

      public void setHistogramInitialSolutionUsed(boolean used) throws LockedException
      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

      public double estimate() throws LockedException, NotReadyException
      Starts the estimation of the most likely value contained within provided input data array.
      Specified by:
      estimate in class MaximumLikelihoodEstimator
      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: