moabb icon indicating copy to clipboard operation
moabb copied to clipboard

Process function crashes expecting a classifier when using MDM from pyRiemann

Open BRomans opened this issue 5 months ago • 7 comments

I am evaluating the sota pipelines for P300 on the MOABB results page. However, the MDM step returns the following error

ValueError: Pipeline should either be a classifier to be used with response_method=predict_proba or the response_method should be 'predict'. Got a regressor with response_method=predict_proba instead.

Am I doing something wrong or did something break with scikit / pyriemann updates?

` pipelines["XdwCov+TS+SVM"] = make_pipeline( XdawnCovariances(nfilter=2, classes=[labels_dict["Target"]], estimator="oas", xdawn_estimator="scm"), TangentSpace(), StandardScaler(), SVC(C=1, kernel="linear", probability=True) )

pipelines["Xdw+LDA"] = make_pipeline(
    Xdawn(nfilter=2, estimator="oas"),
    Vectorizer(),
    LDA(solver="lsqr", shrinkage="auto"),
)

pipelines["XdwCov+MDM"] = make_pipeline(
    XdawnCovariances(nfilter=2, classes=[labels_dict["Target"]], estimator="oas", xdawn_estimator="scm"),
    MDM()
)

`

BRomans avatar Aug 25 '25 15:08 BRomans

@BRomans, can you share some minimal code to reproduce the bug, with the versions of python, moabb and pyriemann you are using?

qbarthelemy avatar Sep 10 '25 10:09 qbarthelemy

and version of sklearn. This could be an issue with cross validation with latest versions of sklearn.

gcattan avatar Sep 10 '25 14:09 gcattan

Hi, here you are a very basic example taken from MOABB tutorials in which I added the MDM() classifier.

moabb_test.py

scikit-learn == 1.6.1 pyriemann == 0.7 Python 3.10.8

BRomans avatar Sep 18 '25 14:09 BRomans

Moabb depends on sklearn <1.6

Can you downgrade your version of sklearn ?

gcattan avatar Sep 18 '25 14:09 gcattan

@gcattan is right: if you use moabb with the correct version of the dependencies, there is no error.

qbarthelemy avatar Sep 18 '25 17:09 qbarthelemy

@BRomans : if you can't downgrade scikit-learn, using pyriemann==0.9 with scikit-learn == 1.6.1 is OK, because the MRO issue was fixed in pyriemann 0.8.

qbarthelemy avatar Sep 19 '25 10:09 qbarthelemy

Can confirm it works, however I had to force -install some stuff because there were multiple clashes with MOABB requirements and NumPy. For now it's sufficient.

BRomans avatar Sep 26 '25 14:09 BRomans