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

Example using Quantum MDM on real data #132

Merged
merged 62 commits into from
Jun 20, 2023
Merged

Conversation

toncho11
Copy link
Collaborator

@toncho11 toncho11 commented May 28, 2023

This PR is focused on testing the Quantum MDM on real data.
The process will take some time to validate the code and the results.

@gcattan
Copy link
Collaborator

gcattan commented May 28, 2023

Hi, very good. In addition, think we can test for different couples of distance and mean for both MDM and QuanticMDM.
I agree this will take some times. Let's try with Quantum=False in the first time as you suggested, and then do the validation with Quantum=True in a second PR.

Do you want me to take a look at the flake8 error?

@toncho11
Copy link
Collaborator Author

Can we disable it temporally for now? :)

Yes, there are a number of parameters to test:

  • Covariance, ErpCovariance, XDawnCovariance
  • number of filters for the XDawn Covariance
  • ...

@toncho11
Copy link
Collaborator Author

toncho11 commented Jun 6, 2023

List of things to test in order to evaluate the new algorithm:

  1. WithinSubjectEvaluation -> done

  2. Shrinkage(shrinkage=0.01) and Shrinkage(shrinkage=0.8) ?

  3. In docplex.py,we can try also to change CobylaOptimizer(rhobeg=0.01, rhoend=0.0001) to CobylaOptimizer(rhobeg=0.1, rhoend=0.00001)

  4. mean = logeuclid, distance = convex , check y_pred if it is all 0 or all 1s.

  5. test merging all subjects and splitting in train/validate to see if the algorithm we generalize better on many subjects instead of per session.

@gcattan
Copy link
Collaborator

gcattan commented Jun 7, 2023

  1. it has an importnace. Here with rho in the range 1...0.000001
    image

@gcattan
Copy link
Collaborator

gcattan commented Jun 8, 2023

There is still some issue with the regularization of the convex mean, so you can only use mean=convex with distance=euclid.
It does help to change rho and shrinkage as follows:
rhobeg=2.1, rhoend=0.000001, shrinkage=0.9

We need to test with different datasets to see if this is consistent. Eventually, we could change the fit method inside QuanticMDM, to optimize these parameters depending on the data.

@gcattan
Copy link
Collaborator

gcattan commented Jun 13, 2023

The mean returned by the docplex model still returns some zeros. It is a problem for other distances than the euclidian one.

I tried the following:

  • ignore NaN when getting the log of the matrix
  • use a warm start
  • replace zeros by some default values

It run, but the results were worst. @qbarthelemy do you have an idea?

Copy link
Member

@qbarthelemy qbarthelemy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no knowledge in the quantum field, but here are some comments.

examples/ERP/classify_P300_bi_quantum_mdm.py Outdated Show resolved Hide resolved
pyriemann_qiskit/utils/distance.py Show resolved Hide resolved
@gcattan
Copy link
Collaborator

gcattan commented Jun 14, 2023

Here are some of the results.

mean=convex/dist=convex run without error with Xdawn covariances (with corrected estimators as suggested above). The results are not good, but also it is not the same space.

In blue is a VotingClassifier with mean=convex/dist=euclid and mean=logeuclid/dist=convex.

Figure_1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants