Пример #1
0
def test_imputer_feature_boston():
    o = Inputers(
        description_filepath="../../descriptions/pre/inputers/boston.yaml")
    train = o.transform(dataset="train")
    imp = Imputers(description_filepath=
                   "../../descriptions/pre/cleaners/most_frequent_impute.yaml")
    assert imp.transform(train, inplace=True, verbose=True).shape == (506, 14)
Пример #2
0
def test_imputer_features_nans_found():
    o = Inputers(
        description_filepath="../../descriptions/pre/inputers/yeast3.yaml")
    train = o.transform(dataset="train")
    train["bad"] = np.NaN
    imp = Imputers(description_filepath=
                   "../../descriptions/pre/cleaners/most_frequent_impute.yaml")
    assert (imp.transform(train, features=["Alm"], inplace=True,
                          verbose=True).isnull().any().any()) == True
Пример #3
0
def test_imputer_feature_boston_err():
    o = Inputers(
        description_filepath="../../descriptions/pre/inputers/boston.yaml")
    train = o.transform(dataset="train")
    train["ggoo"] = np.nan
    imp = Imputers(description_filepath=
                   "../../descriptions/pre/cleaners/most_frequent_impute.yaml")
    with pytest.raises(PasoError):
        assert imp.transform(train, inplace=True,
                             verbose=True).shape == (506, 14)
Пример #4
0
def test_imputer_features_not_found():
    o = Inputers(
        description_filepath="../../descriptions/pre/inputers/yeast3.yaml")
    train = o.transform(dataset="train")
    imp = Imputers(description_filepath=
                   "../../descriptions/pre/cleaners/most_frequent_impute.yaml")
    with pytest.raises(PasoError):
        train = imp.transform(train,
                              features=["bad", "badder", "Alm"],
                              inplace=True,
                              verbose=True)
Пример #5
0
def test_imputer_features_allnans():
    o = Inputers(
        description_filepath="../../descriptions/pre/inputers/yeast3.yaml")
    train = o.transform(dataset="train")
    train["Alm"] = np.NaN
    train.loc[0, "Alm"] = 0
    imp = Imputers(description_filepath=
                   "../../descriptions/pre/cleaners/most_frequent_impute.yaml")
    with pytest.raises(PasoError):
        assert (imp.transform(train,
                              features=["Alm"],
                              inplace=True,
                              verbose=True).isnull().all().all()) == False
Пример #6
0
def test_imputer_given():
    assert len(Imputers().imputers()) == 6