Documentation of 'org.ddogleg.fitting.modelset.lmeds.LeastMedianOfSquares' Java class
LeastMedianOfSquares
org.ddogleg.fitting.modelset.lmeds

Class LeastMedianOfSquares<Model,Point>

  • All Implemented Interfaces:
    ModelMatcher<Model,Point>


    public class LeastMedianOfSquares<Model,Point>
    extends java.lang.Object
    implements ModelMatcher<Model,Point>

    Another technique similar to RANSAC known as Least Median of Squares (LMedS). For each iteration a small number N points are selected. A model is fit to these points and then the error is computed for the whole set. The model which minimizes the median is selected as the final model. No pruning or formal selection of inlier set is done.

    • Constructor Detail

      • LeastMedianOfSquares

        public LeastMedianOfSquares(long randSeed,
                                    int totalCycles,
                                    double maxMedianError,
                                    double inlierFraction,
                                    ModelManager<Model> modelManager,
                                    ModelGenerator<Model,Point> generator,
                                    DistanceFromModel<Model,Point> errorMetric)
        Configures the algorithm.
        Parameters:
        randSeed - Random seed used internally.
        totalCycles - Number of random draws it will make when estimating model parameters.
        maxMedianError - If the best median error is larger than this it is considered a failure.
        inlierFraction - Data which is this fraction or lower is considered an inlier and used to recompute model parameters at the end. Set to 0 to turn off. Domain: 0 to 1.
        generator - Creates a list of model hypotheses from a small set of points.
        errorMetric - Computes the error between a point and a model
      • LeastMedianOfSquares

        public LeastMedianOfSquares(long randSeed,
                                    int totalCycles,
                                    ModelManager<Model> modelManager,
                                    ModelGenerator<Model,Point> generator,
                                    DistanceFromModel<Model,Point> errorMetric)
        Configures the algorithm.
        Parameters:
        randSeed - Random seed used internally.
        totalCycles - Number of random draws it will make when estimating model parameters.
        generator - Creates a list of model hypotheses from a small set of points.
        errorMetric - Computes the error between a point and a model
    • Method Detail

      • setSampleSize

        public void setSampleSize(int sampleSize)
        Number of points it samples to compute a model from. Typically this is the minimum number of points needed.
        Parameters:
        sampleSize - Number of points sampled when computing the model.
      • process

        public boolean process(java.util.List<Point> dataSet)
        Description copied from interface: ModelMatcher
        Finds a set of points from the provided list that are a good fit for the internal model and computes the fit parameters for the model.
        Specified by:
        process in interface ModelMatcher<Model,Point>
        Parameters:
        dataSet - Set of points (with noise) that are to be fit.
        Returns:
        true if it successfully found a solution or false if not.
      • getMatchSet

        public java.util.List<Point> getMatchSet()
        If configured to computer the inlier set it returns the computed inliers. Otherwise it returns the data set orginally passed in.
        Specified by:
        getMatchSet in interface ModelMatcher<Model,Point>
        Returns:
        Set of points that are inliers to the returned model parameters..
      • getInputIndex

        public int getInputIndex(int matchIndex)
        Description copied from interface: ModelMatcher
        For an item in the match set, return the index of the item in the original input set.
        Specified by:
        getInputIndex in interface ModelMatcher<Model,Point>
        Parameters:
        matchIndex - Index of an element in the match set.
        Returns:
        Index of the same element in the original input list.
      • getMinimumSize

        public int getMinimumSize()
        Description copied from interface: ModelMatcher
        This is the minimum number of observations which can be input and produce a valid model.
        Specified by:
        getMinimumSize in interface ModelMatcher<Model,Point>
        Returns:
        Minimum number of sample points

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.