예제 #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()