Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hkctkuy committed Feb 26, 2024
1 parent 7e5ceea commit 889f8ce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion casr/src/bin/casr-cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ fn hierarchical_accumulation(
// New clusters
let mut news: HashMap<usize, Cluster> = HashMap::new();
let mut new_num = max;
for &num in res.iter().skip(clusters.len()).take(deviants.len()) {
for &num in res.iter().skip(clusters.len()) {
if numbers.contains_key(&num) {
continue;
}
Expand Down
16 changes: 9 additions & 7 deletions libcasr/src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,17 @@ impl Cluster {
/// Get complete distance between cluster and report
/// NOTE: Result also can be interpreted as diameter of cluster merge result
pub fn dist_rep(cluster: &Cluster, report: &ReportInfo) -> f64 {
let mut max = 0f64;
let (_, (trace, _)) = report;
for stacktrace in cluster.stacktraces() {
let dist = 1.0 - similarity(stacktrace, trace);
if dist > max {
max = dist;
}
if let Some(max) = cluster
.stacktraces()
.iter()
.map(|s| 1.0 - similarity(s, trace))
.max_by(|a, b| a.total_cmp(b))
{
max
} else {
0f64
}
max
}
}

Expand Down
2 changes: 1 addition & 1 deletion libcasr/src/stacktrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ pub fn dedup_stacktraces(stacktraces: &[Stacktrace]) -> Vec<bool> {
///
/// * `matrix` - condensed dissimilarity matrix
///
/// * `len` - matrix length
/// * `len` - number of observations that are being clustered
///
/// # Return value
///
Expand Down

0 comments on commit 889f8ce

Please sign in to comment.