MCPcopy Create free account
hub / github.com/cosdata/cosdata / should_continue

Function should_continue

src/models/kmeans.rs:7–15  ·  view source on GitHub ↗
(counts: &[usize], threshold: f64, min_clusters: usize)

Source from the content-addressed store, hash-verified

5
6#[allow(dead_code)]
7pub fn should_continue(counts: &[usize], threshold: f64, min_clusters: usize) -> bool {
8 let mean_count = counts.iter().sum::<usize>() as f64 / counts.len() as f64;
9 let threshold_count = mean_count * (1.0 + threshold);
10 counts
11 .iter()
12 .filter(|&&count| count as f64 > threshold_count)
13 .count()
14 >= min_clusters
15}
16
17#[allow(dead_code)]
18pub fn concat_vectors(vectors: &[&[f32]]) -> Vec<i8> {

Callers

nothing calls this directly

Calls 2

iterMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected