Class StatisticalDistanceModelMatcher<Model,Point>
java.lang.Object
org.ddogleg.fitting.modelset.distance.StatisticalDistanceModelMatcher<Model,Point>
- All Implemented Interfaces:
ModelMatcher<Model,
Point>
public class StatisticalDistanceModelMatcher<Model,Point>
extends Object
implements ModelMatcher<Model,Point>
Outliers are removed by first fitting a model to all the data points. Points which deviate the most are removed and the best fit parameters are recomputed. This is done until some error metric changes very little or the maximum number of iterations has been exceeded. Works well when the inlier set is much greater than the noise.
Anyone have a good reference paper for this approach?
-
Field Summary
-
Constructor Summary
ConstructorDescriptionStatisticalDistanceModelMatcher
(int maxIterations, double minChange, double exitCenterError, double failError, int minFitPoints, StatisticalDistance statistics, double pruneThreshold, ModelManager<Model> modelManager, ModelGenerator<Model, Point> modelFitter, DistanceFromModel<Model, Point> modelError, ModelCodec<Model> codec) Creates a new model matcher. -
Method Summary
Modifier and TypeMethodDescriptionprotected double
computeDiff
(Model modelA, Model modelB) Computes the difference between the two parameters.double
Returns the metric used to evaluate the quality of fit.int
getInputIndex
(int matchIndex) For an item in the match set, return the index of the item in the original input set.A set of points which match the provided parameters.int
This is the minimum number of observations which can be input and produce a valid model.Model for the match setReturns a class for the input point objectReturns a class for the input point objectboolean
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.void
reset()
Resets the model matcher to its original state.
-
Field Details
-
param
-
currParam
-
oldCenter
protected double oldCenter -
centerError
protected double centerError
-
-
Constructor Details
-
StatisticalDistanceModelMatcher
public StatisticalDistanceModelMatcher(int maxIterations, double minChange, double exitCenterError, double failError, int minFitPoints, StatisticalDistance statistics, double pruneThreshold, ModelManager<Model> modelManager, ModelGenerator<Model, Point> modelFitter, DistanceFromModel<Model, Point> modelError, ModelCodec<Model> codec) Creates a new model matcher. The type of statistics it uses is specified by "statistics". 0 for mean and standard deviation and 1 for median and percentile. If statistics=0 is set then the threshold correspond to the number of standard deviations a point can be away from the mean before it is pruned. If statistics=1 then points which have a percentile error more than that value are pruned.- Parameters:
maxIterations
- The maximum number of iterations it will perform.minChange
- It will stop iterating of the change in error is less than this amount.exitCenterError
- If the error is less than this value it will stop iterating.failError
- If the final error is more than this amount it failed.minFitPoints
- If fewer than this number of points remain, then it failed.statistics
- 0 = mean statistics and 1 = percentile statisticspruneThreshold
- Points which exceed this statistic are pruned. SeeStatisticalDistance
for details.modelFitter
- Fits a model to a set of pointsmodelError
- Computes the error between a point and the model.
-
-
Method Details
-
process
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 interfaceModelMatcher<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.
-
computeDiff
Computes the difference between the two parameters. -
getModelParameters
Description copied from interface:ModelMatcher
Model for the match set- Specified by:
getModelParameters
in interfaceModelMatcher<Model,
Point> - Returns:
- model.
-
getMatchSet
Description copied from interface:ModelMatcher
A set of points which match the provided parameters.- Specified by:
getMatchSet
in interfaceModelMatcher<Model,
Point> - Returns:
- List of points in the match set.
-
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 interfaceModelMatcher<Model,
Point> - Parameters:
matchIndex
- Index of an element in the match set.- Returns:
- Index of the same element in the original input list.
-
getFitQuality
public double getFitQuality()Description copied from interface:ModelMatcher
Returns the metric used to evaluate the quality of fit. Meaning is implementation specific. Larger or smaller values could be preferred depending on implementation..- Specified by:
getFitQuality
in interfaceModelMatcher<Model,
Point> - Returns:
- Quality of fit to matched set of points
-
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 interfaceModelMatcher<Model,
Point> - Returns:
- Minimum number of sample points
-
reset
public void reset()Description copied from interface:ModelMatcher
Resets the model matcher to its original state. This means that given identical inputs it would produce the same outputs- Specified by:
reset
in interfaceModelMatcher<Model,
Point>
-
getPointType
Description copied from interface:ModelMatcher
Returns a class for the input point object- Specified by:
getPointType
in interfaceModelMatcher<Model,
Point>
-
getModelType
Description copied from interface:ModelMatcher
Returns a class for the input point object- Specified by:
getModelType
in interfaceModelMatcher<Model,
Point>
-