Example #1
0
def test_ScalerList(X):
    g = Scaler("BoxCoxScaler")
    assert g.scalers() == [
        "StandardScaler",
        "MinMaxScaler",
        "Normalizer",
        "MaxAbsScaler",
        "RobustScaler",
        "QuantileTransformer",
        "BoxCoxScaler",
        "LambertScaler",
    ]
Example #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
Example #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
Example #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
Example #5
0
def test_df_BoxCox_type_error(ystr):
    g = Scaler("BoxCoxScaler")
    with pytest.raises(TypeError):
        g.train(ystr())
Example #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
Example #7
0
def test_df_BoxCox_numpy_1d_error(y):
    g = Scaler("BoxCoxScaler")
    with pytest.raises(PasoError):
        g.train(y)
Example #8
0
def test_df_BoxCox_df_type(df_type):
    g = Scaler("BoxCoxScaler")
    assert g.train(df_type) == g
Example #9
0
def test_df_BoxCox_City_NA_error(df_small):
    g = Scaler("BoxCoxScaler")
    with pytest.raises(PasoError):
        g.train(df_small)
Example #10
0
def test_df_Lambert_numpy_1d_error(y):
    g = Scaler("LambertScaler")
    with pytest.raises(PasoError):
        g.train(y)
Example #11
0
def test_df_Class_init_WrongScaler():
    with pytest.raises(PasoError):
        g = Scaler("GORG")
Example #12
0
def test_df_Class_init_NoArg():
    with pytest.raises(TypeError):
        g = Scaler()
Example #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()
Example #14
0
def test_df_Lambert_train(df_type):
    g = Scaler("LambertScaler")
    assert g.train(df_type) == g
Example #15
0
def test_bad_scale_name():
    with pytest.raises(PasoError):
        g = Scaler("fred")
Example #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
Example #17
0
def test_df_BoxCox_City_negative_error(df_City):
    g = Scaler("BoxCoxScaler")
    with pytest.raises(ValueError):
        g.train(df_City)
Example #18
0
def test_df_Lambert_type_error(ystr):
    g = Scaler("LambertScaler")
    with pytest.raises(PasoError):
        g.train(ystr)
Example #19
0
def test_df_Lambert_no_fit(yn):
    g = Scaler("LambertScaler")
    with pytest.raises(AttributeError):
        g.fit()