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

[ENH] enable default for predict in probabilistic regressors if only interval predictions are possible #65

Merged
merged 2 commits into from
Sep 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions skpro/regression/base/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,18 @@ def _predict(self, X):
y : pandas DataFrame, same length as `X`
labels predicted for `X`
"""
implements_interval = self._has_implementation_of("_predict_interval")
implements_quantiles = self._has_implementation_of("_predict_quantiles")
implements_proba = self._has_implementation_of("_predict_proba")

if not implements_proba:
can_do_proba = implements_interval or implements_quantiles or implements_proba

if not can_do_proba:
raise NotImplementedError

if implements_proba:
pred_proba = self._predict_proba(X=X)
pred_mean = pred_proba.mean()
return pred_mean
pred_proba = self._predict_proba(X=X)
pred_mean = pred_proba.mean()
return pred_mean

def predict_proba(self, X):
"""Predict distribution over labels for data from features.
Expand Down
Loading