def test_colfile(self): with NamedTemporaryFile() as target_file: df = pd.read_csv(self.binary_filename) with open(target_file.name, "w") as f: target_series = df["Species"] target_series.to_csv(f, index=False, header="Target") classes = possibly_intuit_order(self.binary_filename, target_data_file=target_file.name) assert set(classes) == {"Iris-versicolor", "Iris-setosa"}
def test_unsupervised(self): classes = possibly_intuit_order(self.regression_filename, target_col_name="MEDV", is_anomaly=True) assert classes is None
def test_badfile(self): with pytest.raises(DrumCommonException): possibly_intuit_order(self.one_target_filename, target_col_name="Species")
def test_colname(self): classes = possibly_intuit_order(self.binary_filename, target_col_name="Species") assert set(classes) == {"Iris-versicolor", "Iris-setosa"}
def test_unsupervised(self): classes = possibly_intuit_order(self.regression_filename, target_col_name="MEDV", unsupervised=True) assert set(classes) == {None, None}
def test_regression(self): classes = possibly_intuit_order(self.regression_filename, target_col_name="MEDV") assert set(classes) == {None, None}