diff --git a/pgml-extension/src/lib.rs b/pgml-extension/src/lib.rs index 378e0a491..c93718898 100644 --- a/pgml-extension/src/lib.rs +++ b/pgml-extension/src/lib.rs @@ -29,19 +29,17 @@ pub extern "C" fn _PG_init() { #[cfg(any(test, feature = "pg_test"))] #[pg_schema] mod tests { - use super::*; - #[test] fn test_migration_file_exists() { let paths = std::fs::read_dir("./sql").unwrap(); for path in paths { let path = path.unwrap().path().display().to_string(); - if path.contains(VERSION) { + if path.contains(crate::VERSION) { return; } } - panic!("Migration file for version {} not found", VERSION); + panic!("Migration file for version {} not found", crate::VERSION); } } diff --git a/pgml-extension/src/metrics.rs b/pgml-extension/src/metrics.rs index c23f27b64..b3c1d2b5d 100644 --- a/pgml-extension/src/metrics.rs +++ b/pgml-extension/src/metrics.rs @@ -52,17 +52,17 @@ impl ConfusionMatrix { y_hat: &ArrayView1, num_classes: usize, ) -> ConfusionMatrix { - if ground_truth.len() != y_hat.len() { - error!("Can't compute metrics when the ground truth labels are a different size than the predicted labels. {} != {}", ground_truth.len(), y_hat.len()) - }; - // Distinct classes. let mut classes = ground_truth.iter().collect::>(); classes.extend(&mut y_hat.iter().collect::>().into_iter()); + if ground_truth.len() != y_hat.len() { + error!("Can't compute metrics when the ground truth labels are a different size than the predicted labels. {} != {}", ground_truth.len(), y_hat.len()); + } + if num_classes != classes.len() { - error!("Can't compute metrics when the number of classes in the test set is different than the number of classes in the training set. {} != {}", num_classes, classes.len()) - }; + error!("Can't compute metrics when the number of classes in the test set is different than the number of classes in the training set. {} != {}", num_classes, classes.len()); + } // Class value = index in the confusion matrix // e.g. class value 5 will be index 4 if there are classes 1, 2, 3 and 4 present. 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