Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] No intersection of coverage error and empirical quantile on conformity score #1245

Closed
leoniewgnr opened this issue Apr 5, 2023 · 2 comments · Fixed by #1248
Closed
Assignees
Labels
type:bug Something isn't working

Comments

@leoniewgnr
Copy link
Collaborator

Describe the bug
When showing the figure of plot_nonconformity_scores in the test test_split_conformal_prediction using the cqr method, the 1-α coverage error (green line) and the empirical quantile q1 (red line), don't meet on the conformity score (blue line).

To Reproduce
Run the following code and add a fig.show() to uncertainty.py to see the plot of fig = plot_nonconformity_scores(self.noncon_scores, self.alpha, self.q_hats[0], method)

def test_split_conformal_prediction():
    log.info("testing: Naive Split Conformal Prediction Air Travel")
    df = pd.read_csv(AIR_FILE)
    m = NeuralProphet(
        seasonality_mode="multiplicative",
        loss_func="MSE",
        quantiles=[0.05, 0.95],
        epochs=EPOCHS,
        batch_size=BATCH_SIZE,
        learning_rate=LR,
    )

    train_df, test_df = m.split_df(df, freq="MS", valid_p=0.2)
    train_df, cal_df = m.split_df(train_df, freq="MS", valid_p=0.15)
    metrics_df = m.fit(train_df, freq="MS")

    alpha = 0.1
    decompose = False
    plotting_backend = "default"
    for method in ["cqr"]: #["naive", "cqr"]:  # Naive and CQR SCP methods
        future = m.make_future_dataframe(
            test_df,
            periods=50,
            n_historic_predictions=len(test_df),
        )
        forecast = m.conformal_predict(
            future,
            calibration_df=cal_df,
            alpha=alpha,
            method=method,
            plotting_backend=plotting_backend,
            decompose=decompose,
        )
        eval_df = uncertainty_evaluate(forecast)

Expected behavior
The intersection of the green and red line, should lie on the blue line.

**Environement **

  • Python environment: Python 3.9, in standalone venv with no other packages
  • Newest NeuralProphet version cloned from Github
    image
@leoniewgnr leoniewgnr added the type:bug Something isn't working label Apr 5, 2023
@leoniewgnr
Copy link
Collaborator Author

@Kevin-Chen0 did you close that one with #1248?

@leoniewgnr
Copy link
Collaborator Author

closed with #1248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants