示例#1
0
def test_ScalerList(X):
    g = Scaler("BoxCoxScaler")
    assert g.scalers() == [
        "StandardScaler",
        "MinMaxScaler",
        "Normalizer",
        "MaxAbsScaler",
        "RobustScaler",
        "QuantileTransformer",
        "BoxCoxScaler",
        "LambertScaler",
    ]
示例#2
0
def test_df_BoxCox_read(df_type):
    g = Scaler("BoxCoxScaler").cacheOn()
    g.train(df_type).predict(df_type)
    fp: str = "tmp/df_write"
    g.write(fp)
    g.read(fp)
    assert (g.trained and g.predicted and g.cache and g.persisted
            and (g.save_file_name == fp)) == True
示例#3
0
def test_df_Lambert_read(df_City):
    g = Scaler("LambertScaler").cacheOn()
    g.train(df_City).predict(df_City)
    fp: str = "tmp/df_write"
    g.write(fp)
    g.read(fp)
    assert (g.trained and g.predicted and g.cache and g.persisted
            and (g.save_file_name == fp)) == True
示例#4
0
def test_df_MinMax_write(df_type):
    g = Scaler("MinMaxScaler").cacheOn()
    g.train(df_type).predict(df_type)
    fp: str = "tmp/df"
    g.write(fp)
    assert (g.trained and g.predicted and g.cache and g.persisted
            and (g.save_file_name == fp)) == True
示例#5
0
def test_df_BoxCox_type_error(ystr):
    g = Scaler("BoxCoxScaler")
    with pytest.raises(TypeError):
        g.train(ystr())
示例#6
0
def test_predict_df_BoxCox_df_type(df_type):
    g = Scaler("BoxCoxScaler")
    g.train(df_type)
    assert g.predict(df_type).shape == df_type.shape
示例#7
0
def test_df_BoxCox_numpy_1d_error(y):
    g = Scaler("BoxCoxScaler")
    with pytest.raises(PasoError):
        g.train(y)
示例#8
0
def test_df_BoxCox_df_type(df_type):
    g = Scaler("BoxCoxScaler")
    assert g.train(df_type) == g
示例#9
0
def test_df_BoxCox_City_NA_error(df_small):
    g = Scaler("BoxCoxScaler")
    with pytest.raises(PasoError):
        g.train(df_small)
示例#10
0
def test_df_Lambert_numpy_1d_error(y):
    g = Scaler("LambertScaler")
    with pytest.raises(PasoError):
        g.train(y)
示例#11
0
def test_df_Class_init_WrongScaler():
    with pytest.raises(PasoError):
        g = Scaler("GORG")
示例#12
0
def test_df_Class_init_NoArg():
    with pytest.raises(TypeError):
        g = Scaler()
示例#13
0
def test_df_BoxCox_inverse(df_type):
    g = Scaler("BoxCoxScaler")
    g.train(df_type, inplace=False)
    assert g.inverse_predict(g.predict(df_type) == df_type).any().any()
示例#14
0
def test_df_Lambert_train(df_type):
    g = Scaler("LambertScaler")
    assert g.train(df_type) == g
示例#15
0
def test_bad_scale_name():
    with pytest.raises(PasoError):
        g = Scaler("fred")
示例#16
0
def test_df_Lambert_predict(df_type):
    g = Scaler("LambertScaler")
    g.train(df_type)
    assert g.predict(df_type).shape == df_type.shape
示例#17
0
def test_df_BoxCox_City_negative_error(df_City):
    g = Scaler("BoxCoxScaler")
    with pytest.raises(ValueError):
        g.train(df_City)
示例#18
0
def test_df_Lambert_type_error(ystr):
    g = Scaler("LambertScaler")
    with pytest.raises(PasoError):
        g.train(ystr)
示例#19
0
def test_df_Lambert_no_fit(yn):
    g = Scaler("LambertScaler")
    with pytest.raises(AttributeError):
        g.fit()