示例#1
0
def test_save():
    filepath = "./datasets/configs/params.json"
    params = {
        "param1": 69,
        "param2": {
            "nestedParam": 420
        },
        "Split": 6969,
    }
    save_config(filepath, params)
    contents = read_config(filepath)
    assert params == contents
示例#2
0
def test_save():
    filepath = "./datasets/configs/params.json"
    params = {
        "param1": 69,
        "param2": {"nestedParam": 420},
        "Split": 6969,
        "df": "./datasets/encoding/test.csv",
    }
    save_config(filepath, params)
    contents = read_config(filepath)
    params.pop("df")
    assert params == contents
示例#3
0
def test_config():
    df = pd.DataFrame({"A": np.arange(1, 100), "B": np.arange(1, 100)})
    _ = df.to_csv("./datasets/configs/dataset.csv", index=False)
    params = {
        "col_1": "A",
        "col_2": "B",
        "test_size": 0.2,
    }
    config_path = "./datasets/configs/pipeline_config.json"
    save_config(config_path, params)
    pipeline = BasePipeline(
        train_df_path="./datasets/configs/dataset.csv",
        steps=[times_two, squared, split],
        config_file=config_path,
        custom_reader=custom_read,
    )
    pipeline.process()
    assert len(pipeline.params["X_train"]) == 80
    pipeline.remove("split")
    pipeline.process()
    assert (pipeline.params["train_df"].shape[0] ==
            pipeline.params["train_df_copy"].shape[0])