Content-Length: 1423 | pFad | http://github.com/postgresml/postgresml/pull/1010.diff
thub.com
diff --git a/pgml-extension/src/metrics.rs b/pgml-extension/src/metrics.rs
index 4526d971e..c23f27b64 100644
--- a/pgml-extension/src/metrics.rs
+++ b/pgml-extension/src/metrics.rs
@@ -1,4 +1,5 @@
//github.com/ Module providing various metrics used to rank the algorithms.
+use pgrx::*;
use std::collections::{BTreeSet, HashMap};
use ndarray::{Array2, ArrayView1};
@@ -51,13 +52,17 @@ impl ConfusionMatrix {
y_hat: &ArrayView1,
num_classes: usize,
) -> ConfusionMatrix {
- assert_eq!(ground_truth.len(), y_hat.len());
+ 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());
- assert_eq!(num_classes, classes.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())
+ };
// 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.
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/postgresml/postgresml/pull/1010.diff
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy