I wanted to pass a SlidingEstimator instance to sklearn's cross_val_predict(), but it gets red squiggly lines:

The error message is:
Argument of type "SlidingEstimator" cannot be assigned to parameter "estimator" of type "BaseEstimator" in function "cross_val_predict"
"SlidingEstimator" is incompatible with "BaseEstimator"
The reason is that SlidingEstimator doesn't inherit from sklearn's BaseEstimator, but from mne.fixes.BaseEstimator.
My current workaround is cast()ing the type:
from typing import cast
from sklearn.base import BaseEstimator
predictions = cross_val_predict(
cast(BaseEstimator, model),
X,
labels["cue"],
cv=cv,
n_jobs=-1,
)
I wanted to pass a

SlidingEstimatorinstance to sklearn'scross_val_predict(), but it gets red squiggly lines:The error message is:
The reason is that
SlidingEstimatordoesn't inherit from sklearn'sBaseEstimator, but frommne.fixes.BaseEstimator.My current workaround is
cast()ing the type: