Ejemplo n.º 1
0
 def test_compute_sample(self, input_data, expected_value):
     params = input_data.copy()
     vals = {}
     vals["y_pred"] = params.pop("y_pred")
     vals["y"] = params.pop("y")
     metric = ConfusionMatrixMetric(**params)
     metric(**vals)
     result, _ = metric.aggregate()[0]
     np.testing.assert_allclose(result, expected_value, atol=1e-4, rtol=1e-4)
Ejemplo n.º 2
0
 def test_clf_with_nan(self, input_data, expected_value):
     params = input_data.copy()
     vals = {}
     vals["y_pred"] = params.pop("y_pred")
     vals["y"] = params.pop("y")
     metric = ConfusionMatrixMetric(**params)
     result = metric(**vals)
     np.testing.assert_allclose(result, expected_value, atol=1e-4, rtol=1e-4)
     result, _ = metric.aggregate(reduction="mean_channel")[0]
     expected_value, _ = do_metric_reduction(expected_value, "mean_channel")
     expected_value = compute_confusion_matrix_metric("tpr", expected_value)
     np.testing.assert_allclose(result, expected_value, atol=1e-4, rtol=1e-4)
Ejemplo n.º 3
0
 def test_compute_sample_multiple_metrics(self, input_data, expected_values):
     params = input_data.copy()
     vals = {}
     vals["y_pred"] = params.pop("y_pred")
     vals["y"] = params.pop("y")
     metric = ConfusionMatrixMetric(**params)
     metric(**vals)
     results = metric.aggregate()
     for idx in range(len(results)):
         result = results[idx][0]
         expected_value = expected_values[idx]
         np.testing.assert_allclose(result, expected_value, atol=1e-4, rtol=1e-4)