Skip to content

Commit df09b1f

Browse files
authored
use bits instead of strings (#314)
1 parent 6001b2f commit df09b1f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pgml-extension/pgml_rust/src/orm/dataset.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ impl Dataset {
3030

3131
pub fn distinct_labels(&self) -> u32 {
3232
let mut v = HashSet::new();
33-
self.y.iter().for_each(|i| if !i.is_nan() { v.insert(i.to_string()); });
33+
// Treat the f32 values as u32 for std::cmp::Eq. We don't
34+
// care about the nuance of nan equality here, they should
35+
// already be filtered out upstream.
36+
self.y.iter().for_each(|i| if !i.is_nan() { v.insert(i.to_bits()); });
3437
v.len().try_into().unwrap()
3538
}
3639
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy