Exemple #1
0
 def test_mismatch_input_numbers(self):
     with pytest.raises(valid.ValidationError):
         report.compare(
             {
                 0: self.X,
                 1: self.X
             },
             {
                 0: self.y,
                 1: self.y
             },
             {1: self.prtc_attr},
             self.model_dict,
             flag_oor=False,
         )
Exemple #2
0
 def test_missing_keys(self):
     with pytest.raises(valid.ValidationError):
         report.compare(
             {
                 0: self.X,
                 1: self.X
             },
             {
                 0: self.y,
                 1: self.y
             },
             None,
             self.model_dict,
             flag_oor=False,
         )
Exemple #3
0
 def test_single_dataInputs(self):
     result = report.compare(self.X,
                             self.y,
                             self.prtc_attr,
                             self.model_dict,
                             flag_oor=False)
     self.is_result_valid(result)
Exemple #4
0
 def test_preds_not_models(self):
     result = report.compare(
         [self.X, self.X],
         self.y,
         self.prtc_attr,
         predictions=[self.y, self.y],
         flag_oor=False,
     )
     self.is_result_valid(result)
Exemple #5
0
 def test_with_protected_attributes(self):
     result = report.compare(
         [self.X, self.X],
         [self.y, self.y],
         [self.prtc_attr, self.prtc_attr],
         [self.model_dict[0], self.model_dict[1]],
         flag_oor=False,
     )
     self.is_result_valid(result)
Exemple #6
0
 def test_mixed_groupings(self):
     result = report.compare(
         [self.X, self.X],
         self.y,
         self.prtc_attr,
         [self.model_dict[0], self.model_dict[1]],
         flag_oor=False,
     )
     self.is_result_valid(result)
Exemple #7
0
 def test_differing_keys(self):
     with pytest.raises(valid.ValidationError):
         report.compare(
             {
                 5: self.X,
                 6: self.X
             },
             {
                 0: self.y,
                 1: self.y
             },
             {
                 0: self.prtc_attr,
                 1: self.prtc_attr
             },
             self.model_dict,
             flag_oor=False,
         )
Exemple #8
0
 def test_invalid_model_member(self):
     with pytest.raises(valid.ValidationError):
         report.compare(
             {
                 0: self.X,
                 1: self.X
             },
             {
                 0: self.y,
                 1: self.y
             },
             {
                 0: self.prtc_attr,
                 1: None
             },
             self.model_dict,
             flag_oor=False,
         )
Exemple #9
0
 def test_preds_and_probs(self):
     result = report.compare(
         [self.X, self.X],
         self.y,
         self.prtc_attr,
         predictions=[self.y, self.y],
         probabilities=[self.y, self.y],
         flag_oor=False,
     )
     self.is_result_valid(result)
Exemple #10
0
 def test_outputType_withFlag_invalid(self):
     with pytest.raises(ValueError):
         _ = report.compare(
             [self.X, self.X],
             self.y,
             self.prtc_attr,
             predictions=[self.y, self.y],
             probabilities=[self.y, self.y],
             flag_oor=True,
             output_type="dataframe",
         )
Exemple #11
0
 def test_embeddedHTML_withFlag_valid(self):
     result = report.compare(
         [self.X, self.X],
         self.y,
         self.prtc_attr,
         predictions=[self.y, self.y],
         probabilities=[self.y, self.y],
         flag_oor=True,
         output_type="html",
     )
     assert isinstance(result, str)
 def test_compare_flags(self):
     result = report.compare(
         self.df,
         self.df["classification"],
         self.df["prtc_attr"],
         predictions=[
             self.df["avg_classification"], self.df["avg_classification"]
         ],
         pred_type="classification",
         flag_oor=True,
     )
Exemple #13
0
 def test_missing_models(self):
     with pytest.raises(valid.ValidationError):
         report.compare(
             {
                 0: self.X,
                 1: self.X
             },
             {
                 0: self.y,
                 1: self.y
             },
             {
                 0: self.prtc_attr,
                 1: self.prtc_attr
             },
             {
                 0: None,
                 1: None
             },
             flag_oor=False,
         )
Exemple #14
0
 def test_model_list(self):
     result = report.compare(self.X,
                             self.y,
                             self.prtc_attr, [self.model_dict[0]],
                             flag_oor=False)
     self.is_result_valid(result)
Exemple #15
0
 def test_multiple_calls(self):
     args = (self.X, self.y, self.prtc_attr, self.model_dict[0])
     _ = report.compare(*args, flag_oor=False)
     result = report.compare(*args, flag_oor=False)
     self.is_result_valid(result)