Ejemplo n.º 1
0
def test_StandardScaler_output(test_input):
    scaler = Scaler()
    scaler.execute(params=test_input)
    if "Distance" in test_input["train_df"].keys():
        assert round(test_input["train_df"]["Distance"][0], 5) == 1.08006
    else:
        assert round(test_input["train_df"]["Negatives"][0], 5) == 0.57771
Ejemplo n.º 2
0
def test_BinaryScaler_output(test_input):
    scaler = Scaler()
    scaler.execute(params=test_input)
    assert (test_input["df"]["Negatives"].values.any() == 1
            or test_input["df"]["Negatives"].values.any() == 0)
    assert not (test_input["df"]["Negatives"].between(0, 1,
                                                      inclusive=False).any())
    assert test_input["df"]["Negatives"][0] == 1
Ejemplo n.º 3
0
def test_MinMaxScaler_output(test_input):
    scaler = Scaler()
    scaler.execute(params=test_input)
    if "Distance" in test_input["train_df"].keys():
        assert test_input["train_df"]["Distance"].values.all() >= 0
        assert test_input["train_df"]["Distance"].values.all() <= 1
    else:
        assert test_input["train_df"]["Negatives"].values.all() >= 0
        assert test_input["train_df"]["Negatives"].values.all() <= 1
Ejemplo n.º 4
0
def test_BinaryScaler_output(test_input):
    scaler = Scaler()
    scaler.execute(params=test_input)
    assert (test_input["train_df"]["Negatives"].values.any() == 1
            or test_input["train_df"]["Negatives"].values.any() == 0)
    assert not (test_input["train_df"]["Negatives"].between(
        0, 1, inclusive="neither").any())
    if test_input["threshold"]["Negatives"] != -1:
        assert test_input["train_df"]["Negatives"][0] == 1
    else:
        assert test_input["train_df"]["Negatives"][0] == 0
Ejemplo n.º 5
0
def test_incorrect_input_type(test_input, error):
    with pytest.raises(error):
        scaler = Scaler()
        scaler.execute(params=test_input)
Ejemplo n.º 6
0
def test_MinMaxScaler_output(test_input):
    scaler = Scaler()
    scaler.execute(params=test_input)
    assert test_input["df"]["Distance"].values.all() >= 0
    assert test_input["df"]["Distance"].values.all() <= 1