Documentation of 'jsat.regression.RANSAC' Java class
RANSAC
jsat.regression

Class RANSAC

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Parameterized, Regressor


    public class RANSAC
    extends java.lang.Object
    implements Regressor, Parameterized
    RANSAC is a randomized meta algorithm that is useful for fitting a model to a data set that has a large amount of outliers that do not represent the true distribution well.
    RANSAC has the concept of inliers and outliers. An initial number of seed points is specified. This makes the initial inlier set. The algorithm than iterates several times, randomly selecting the specified number of points. It then regresses on all other points, adding all points within a specified absolute error to the set of inliers. The model is then trained again on the larger set, and the training error becomes the measure of the strength of the model. The model that has the lowest error is then the fit model.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      RANSAC(Regressor baseRegressor, int iterations, int initialTrainSize, int minResultSize, double maxPointError)
      Creates a new RANSAC training object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      RANSAC clone() 
      Regressor getBaseRegressorClone()
      Once RANSAC is complete, it maintains its trained version of the finalized regressor.
      boolean[] getConsensusSet()
      Returns an boolean array where the indices correspond to data points in the original training set.
      int getInitialTrainSize()
      Returns the number of data points to be sampled from the training set to create initial models.
      int getIterations()
      Returns the number models that will be tested on the data set.
      double getMaxPointError()
      Each data point not in the initial training set will be tested against.
      int getMinResultSize()
      RANSAC requires an initial model to be accurate enough to include a minimum number of inliers before being considered as a potentially good model.
      double getModelError()
      Returns the model error, which is the average absolute difference between the model and all points in the set of inliers.
      double regress(DataPoint data) 
      void setInitialTrainSize(int initialTrainSize)
      Sets the number of data points to be sampled from the training set to create initial models.
      void setIterations(int iterations)
      Sets the number models that will be tested on the data set.
      void setMaxPointError(double maxPointError)
      Each data point not in the initial training set will be tested against.
      void setMinResultSize(int minResultSize)
      RANSAC requires an initial model to be accurate enough to include a minimum number of inliers before being considered as a potentially good model.
      boolean supportsWeightedData() 
      void train(RegressionDataSet dataSet, boolean parallel) 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RANSAC

        public RANSAC(Regressor baseRegressor,
                      int iterations,
                      int initialTrainSize,
                      int minResultSize,
                      double maxPointError)
        Creates a new RANSAC training object. Because RANSAC is sensitive to parameter settings, which are data and model dependent, no default values exist for them.
        Parameters:
        baseRegressor - the model to fit using RANSAC
        iterations - the number of iterations of the algorithm to perform
        initialTrainSize - the number of points to seed each iteration of training with
        minResultSize - the minimum number of inliers to make it into the model to be considered a possible fit.
        maxPointError - the maximum allowed absolute difference in the output of the model and the true value for the data point to be added to the inlier set.
    • Method Detail

      • getInitialTrainSize

        public int getInitialTrainSize()
        Returns the number of data points to be sampled from the training set to create initial models.
        Returns:
        the number of data points used to first create models
      • setInitialTrainSize

        public void setInitialTrainSize(int initialTrainSize)
        Sets the number of data points to be sampled from the training set to create initial models.
        Parameters:
        initialTrainSize - the number of data points to use to create models
      • getIterations

        public int getIterations()
        Returns the number models that will be tested on the data set.
        Returns:
        the number of algorithm iterations
      • setIterations

        public void setIterations(int iterations)
        Sets the number models that will be tested on the data set.
        Parameters:
        iterations - the number of iterations to perform
      • getMaxPointError

        public double getMaxPointError()
        Each data point not in the initial training set will be tested against. If a data points error is sufficiently small, it will be added to the set of inliers.
        Returns:
        the maximum error any one point may have to be an inliner
      • setMaxPointError

        public void setMaxPointError(double maxPointError)
        Each data point not in the initial training set will be tested against. If a data points error is sufficiently small, it will be added to the set of inliers.
        Parameters:
        maxPointError - the new maximum error a data point may have to be considered an inlier.
      • getMinResultSize

        public int getMinResultSize()
        RANSAC requires an initial model to be accurate enough to include a minimum number of inliers before being considered as a potentially good model. This is the number of points that must make it into the inlier set for a model to be considered.
        Returns:
        the minimum number of inliers to be considered
      • setMinResultSize

        public void setMinResultSize(int minResultSize)
        RANSAC requires an initial model to be accurate enough to include a minimum number of inliers before being considered as a potentially good model. This is the number of points that must make it into the inlier set for a model to be considered.
        Parameters:
        minResultSize - the minimum number of inliers to be considered
      • clone

        public RANSAC clone()
        Specified by:
        clone in interface Regressor
        Overrides:
        clone in class java.lang.Object
      • getBaseRegressorClone

        public Regressor getBaseRegressorClone()
        Once RANSAC is complete, it maintains its trained version of the finalized regressor. A clone of it may be retrieved from this method.
        Returns:
        a clone of the learned regressor
      • getConsensusSet

        public boolean[] getConsensusSet()
        Returns an boolean array where the indices correspond to data points in the original training set. true indicates that the data point was apart of the final consensus set. false indicates that it was not.
        Returns:
        a boolean array indicating which points made it into the consensus set
      • getModelError

        public double getModelError()
        Returns the model error, which is the average absolute difference between the model and all points in the set of inliers.
        Returns:
        the error for the learned model. Returns Double.POSITIVE_INFINITY if the model has not been trained or failed to fit.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.