The Random Sample Consensus (RANSAC) algorithm is a regressor algorithm that discards outliers automatically.

The algorithm works as follows:

  1. Select a random subset from the data. Call this subset the hypothetical inliners.
  2. Fit a model to these hypotetical inliners.
  3. Test all of the other data points against this model.
    1. For those points that, according to a loss function, perform well enough, are also considered part of the consensus set.
  4. The model is considered good enough if a certain amount of points made it into the consensus set.
  5. Iterate times, keeping the best model.