MCPcopy Create free account
hub / github.com/daniel-e/rustml / test_knn_classify

Function test_knn_classify

src/knn.rs:82–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80
81 #[test]
82 fn test_knn_classify() {
83
84 let m = mat![
85 1.0, 2.0;
86 1.1, 2.1;
87 2.0, 3.0;
88 0.9, 1.9;
89 2.1, 2.9
90 ];
91
92 let labels = vec![1, 2, 2, 1, 2];
93 let target = classify(&m, &labels, &[1.3, 2.0], 3, |x, y| Euclid::compute(x, y).unwrap());
94 assert_eq!(target, 1);
95 }
96
97 #[test]
98 fn test_scan() {

Callers

nothing calls this directly

Calls 1

classifyFunction · 0.85

Tested by

no test coverage detected