I hereby claim:
- I am nlw0 on github.
- I am nlw (https://keybase.io/nlw) on keybase.
- I have a public key whose fingerprint is 10B8 F2FF 91E3 C3D8 1644 1357 AD36 B217 6919 3B91
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
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)) | |
} | |
} |
import estimation.RobustEstimator | |
import geometry.{Line, Point} | |
import scala.math.abs | |
import scala.util.Random | |
object TestRANSAC extends App { | |
val n_outliers = 100 | |
val n_inliers = 100 |
import scala.math.sqrt | |
import scala.util.Random | |
trait Vec2d { | |
def x: Double | |
def y: Double | |
def -(that: Point): Point = Point(this.x - that.x, this.y - that.y) |
object Quicksort extends App { | |
val inputStream = io.Source.fromInputStream(System.in) | |
val data = inputStream.getLines().toStream map (_.toInt) | |
quicksort(data) foreach { println(_) } | |
def quicksort(x: Stream[Int]): Stream[Int] = if (x.isEmpty) Stream() else { | |
val pivot = x.head | |
val (a, b) = x.tail.partition(_ <= pivot) | |
quicksort(a) #::: pivot #:: quicksort(b) |
object Quicksort extends App { | |
val inputStream = io.Source.fromInputStream(System.in) | |
val data = inputStream.getLines().toList map (_.toInt) | |
quicksort(data) foreach { println(_) } | |
def quicksort(x: List[Int]): List[Int] = if (x.isEmpty) List() else { | |
val pivot = x.head | |
val (a, b) = x.tail.partition(_ <= pivot) | |
val coisa = quicksort(a) ::: pivot :: quicksort(b) |