Exemple #1
0
def test_calibrate(reg_dataset):
    x_train = reg_dataset[0]
    y_train = reg_dataset[1]
    x_cal = reg_dataset[2]
    y_cal = reg_dataset[3]
    adapt_model = Adapt_to_CP(RandomForestRegressor(n_estimators=10), True)
    adapt_model.fit(x_train, y_train)
    assert adapt_model.calibrate(x_cal, y_cal) == None
Exemple #2
0
def test_calibrate_and_predict_upper(reg_dataset):
    x_train = reg_dataset[0]
    y_train = reg_dataset[1]
    x_cal = reg_dataset[2]
    y_cal = reg_dataset[3]
    x_test = reg_dataset[4]
    adapt_model = Adapt_to_CP(RandomForestRegressor(n_estimators=10), True)
    adapt_model.fit(x_train, y_train)
    pred = adapt_model.calibrate_and_predict(x_cal, y_cal, x_test, 0.8)
    assert type(pred[2]) == np.ndarray
Exemple #3
0
def test_fit(reg_dataset):
    x_train = reg_dataset[0]
    y_train = reg_dataset[1]
    model = RandomForestRegressor(n_estimators=10)
    assert Adapt_to_CP(model, True).fit(x_train, y_train) == None
Exemple #4
0
def test_Adapt_to_CP_icp(mod, sk_mod, icp):
    adapted_mod = Adapt_to_CP(mod, sk_mod)
    assert type(adapted_mod.icp) == icp
Exemple #5
0
def test_Adapt_to_CP_model(model, sk_model, adapt_model):
    adapted_mod = Adapt_to_CP(model, sk_model)
    assert type(adapted_mod.model) == adapt_model