Last active
January 15, 2017 21:44
-
-
Save nlw0/7642a5cc8ac5ef884efda8cc92b48ff6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RobustEstimator[Data, Hypothesis, Model](sampler: Seq[Data] => Hypothesis, | |
model_generator: Hypothesis => Model, | |
inlier_detector: Model => Data => Boolean) { | |
def estimate(data: Seq[Data], iterations: Int): Model = { | |
val minimal_sets = Seq.fill(iterations)(sampler(data)) | |
val hypothetical_models = minimal_sets map model_generator | |
hypothetical_models.maxBy(m => data count inlier_detector(m)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment