juaml / julearn

Forschungszentrum Jülich Machine Learning Library
https://juaml.github.io/julearn
GNU Affero General Public License v3.0
30 stars 19 forks source link

[BUG]: Not fitted error in the inspector after fitting in some situations (edge case) #225

Closed samihamdan closed 8 months ago

samihamdan commented 1 year ago

Is there an existing issue for this?

Current Behavior

It can happen that a sklearn pipline reports its not fitted if the last step has no fit params and no extra method for this. This can lead to an error in the PipelineInspector which checks whether the pipeline is fitted.

Expected Behavior

Maybe one can give a better error or provide extra function. But I mostly just want to report an edge case.

Steps To Reproduce

Create a sklearn estimator model without any info about fitted params etc e.g."

class MockRegressorReturnsIndex(BaseEstimator):
    def fit(self, X, y=None, **fit_params):
        return self

    def predict(self, X):
        return X.index

Environment

Newest branch of the julearn_sk_pandas branche

Relevant log output

No response

Anything else?

No response

fraimondo commented 1 year ago

But what would be a real scenario of an estimator that does not have any fit params?

samihamdan commented 1 year ago

It is an edge case for sure, but the real world example would be a transformer that shuffles the features on transform. It does not really fit anything. This has low prio and I think solutions would be easy to do for an individual creating such a transformer (e.g. one could just set a self.fit_).

Therefore, I am also fine with closing the issue and just note that we do not support this. Just wanted to document that I saw behavior I did not expect.

github-actions[bot] commented 8 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.