Ejemplo n.º 1
0
 def test_add_to_one_happy(self):
     positive_label = "poslabel"
     negative_label = "neglabel"
     adapter = PythonModelAdapter(model_dir=None, target_type=TargetType.BINARY)
     df = pd.DataFrame({positive_label: [0.1, 0.2, 0.3], negative_label: [0.9, 0.8, 0.7]})
     adapter._validate_predictions(
         to_validate=df, class_labels=[positive_label, negative_label],
     )
Ejemplo n.º 2
0
 def test_add_to_one_sad(self):
     positive_label = "poslabel"
     negative_label = "neglabel"
     adapter = PythonModelAdapter(model_dir=None, target_type=TargetType.BINARY)
     df = pd.DataFrame({positive_label: [1, 1, 1], negative_label: [-1, 0, 0]})
     with pytest.raises(ValueError):
         adapter._validate_predictions(
             to_validate=df, class_labels=[positive_label, negative_label],
         )
Ejemplo n.º 3
0
 def test_regression_predictions_header(self):
     adapter = PythonModelAdapter(model_dir=None, target_type=TargetType.REGRESSION)
     df = pd.DataFrame({"Predictions": [0.1, 0.2, 0.3]})
     adapter._validate_predictions(
         to_validate=df, class_labels=None,
     )
     with pytest.raises(ValueError):
         df = pd.DataFrame({"other_name": [0.1, 0.2, 0.3]})
         adapter._validate_predictions(
             to_validate=df, class_labels=None,
         )
Ejemplo n.º 4
0
 def test_add_to_one_happy(self):
     positive_label = "poslabel"
     negative_label = "neglabel"
     adapter = PythonModelAdapter(model_dir=None)
     df = pd.DataFrame({
         positive_label: [0.1, 0.2, 0.3],
         negative_label: [0.9, 0.8, 0.7]
     })
     adapter._validate_predictions(
         to_validate=df,
         positive_class_label=positive_label,
         negative_class_label=negative_label,
     )
Ejemplo n.º 5
0
 def test_class_labels(self):
     positive_label = "poslabel"
     negative_label = "neglabel"
     adapter = PythonModelAdapter(model_dir=None, target_type=TargetType.BINARY)
     df = pd.DataFrame({positive_label: [0.1, 0.2, 0.3], negative_label: [0.9, 0.8, 0.7]})
     adapter._validate_predictions(
         to_validate=df, class_labels=[positive_label, negative_label],
     )
     with pytest.raises(ValueError):
         df = pd.DataFrame({positive_label: [0.1, 0.2, 0.3], negative_label: [0.9, 0.8, 0.7]})
         adapter._validate_predictions(
             to_validate=df, class_labels=["yes", "no"],
         )
Ejemplo n.º 6
0
 def test_add_to_one_sad(self):
     positive_label = "poslabel"
     negative_label = "neglabel"
     adapter = PythonModelAdapter(model_dir=None)
     df = pd.DataFrame({
         positive_label: [1, 1, 1],
         negative_label: [-1, 0, 0]
     })
     with pytest.raises(ValueError):
         adapter._validate_predictions(
             to_validate=df,
             positive_class_label=positive_label,
             negative_class_label=negative_label,
         )