Exemplo n.º 1
0
def test_bin_with_size_zero():
    # Data
    p_cal = .5 * np.ones([100, 2])
    y_cal = np.hstack([np.ones([50]), np.zeros([50])])

    # Fit calibration model
    bbq = calm.BayesianBinningQuantiles()
    bbq.fit(X=p_cal, y=y_cal)

    # Predict
    p_pred = bbq.predict_proba(X=p_cal)

    # Check for NaNs
    assert not np.any(np.isnan(p_pred)), "Calibrated probabilities are NaN."
Exemplo n.º 2
0
                           random_state=random_state),
        "GPcalib_approx":
        calm.GPCalibration(n_classes=2,
                           maxiter=1000,
                           n_inducing_points=10,
                           logits=False,
                           random_state=random_state,
                           inf_mean_approx=True),
        "Platt":
        calm.PlattScaling(random_state=random_state),
        "Isotonic":
        calm.IsotonicRegression(),
        "Beta":
        calm.BetaCalibration(),
        "BBQ":
        calm.BayesianBinningQuantiles(),
        "Temp":
        calm.TemperatureScaling()
    }

    # Create benchmark object
    kitti_benchmark = pycalib.benchmark.KITTIBinaryData(
        run_dir=run_dir,
        clf_output_dir=clf_output_dir,
        classifier_names=classifier_names,
        cal_methods=list(cal_methods.values()),
        cal_method_names=list(cal_methods.keys()),
        n_splits=10,
        test_size=8000,
        train_size=1000,
        random_state=random_state)