Semi-ready implementation of Simple KNN

This commit is contained in:
Volodymyr Orlov
2019-09-16 08:52:12 -07:00
parent 9c5f6eb307
commit 3efd078034
6 changed files with 125 additions and 99 deletions
+2 -3
View File
@@ -2,8 +2,7 @@
extern crate criterion;
extern crate smartcore;
extern crate ndarray;
use ndarray::Array;
use smartcore::math::distance::euclidian::EuclidianDistance;
use ndarray::{Array, Array1};
use smartcore::math::distance::Distance;
use criterion::Criterion;
@@ -12,7 +11,7 @@ use criterion::black_box;
fn criterion_benchmark(c: &mut Criterion) {
let a = Array::from_vec(vec![1., 2., 3.]);
c.bench_function("Euclidean Distance", move |b| b.iter(|| EuclidianDistance::distance(black_box(&a), black_box(&a))));
c.bench_function("Euclidean Distance", move |b| b.iter(|| Array1::distance(black_box(&a), black_box(&a))));
}
criterion_group!(benches, criterion_benchmark);