aws/random-cut-forest-by-aws

rust summarize_list error

acpeakhour opened this issue · 1 comments

When using the Rust lib, BasicTRCF gives an indexing error. The below patch seems to fix this.

@@ -56,14 +56,14 @@ impl FieldSummarizer {
&self,
pointstore: &dyn PointStore,
point_list_with_distance: &[(f64, usize, f64)],
missing: &[usize]
) -> SampleSummary {
let mut distance_list: Vec = point_list_with_distance.iter().map(|a| a.2).collect();
distance_list.sort_by(|a, b| a.partial_cmp(&b).unwrap());
let mut threshold = 0.0;
if self.centrality > 0.0 {
let mut always_include = 0;

  •        while always_include < point_list_with_distance.len()
    
  •        while always_include < point_list_with_distance.len() - 1
               && distance_list[always_include] == 0.0
           {
               always_include += 1;
    

duplicate with 362