Closed
Description
Hi,
currently calling predict
on an uninitialized estimator throws a NotInitializedError
instead of scikit-learn's NotFittedError
. This is problematic in cases where we want to be able to handle different kinds of estimators while providing some kind of fallback behavior. Currently we need
try:
prediction = estimator.predict(X)
except (NotFittedError, NotInitializedError):
# some fallback behavior
I think it would be better if NotInitializedError
was a subclass of NotFittedError
. In that case we could treat an skorch estimator like a regular scikit-learn estimator and simply catch NotFittedError
.
Would a PR in that direction be welcome?