Skip to content
Jean-Rémi KING edited this page Mar 14, 2016 · 5 revisions

Decoding

In M/EEG decoding in simple terms means, to predict what the samples of brain signals corresponds to. Machine learning approaches are used for predictions. In MNE decoding module currently is quite disorganized needs refactoring, usability improvements and other enhancements. This will particularly involve making it more compatible with Scikit-Learn API.

Project Detail

There are various functions, classes in decoding that needs work. The main aim is to make it compatible with Scikit-Learn API. Other than that there are other improvements needed as well, described as follows

  1. Enhance decoding objects to follow sklearn API. As mentioned above this will be the primary objective of GSoC. There are several sub- tasks that needs to be taken care of:

    • GAT and EMS should work with cross validation and grid-search method of Scikit-Searn. One should be able to successfully execute cross_val_score(GAT, X, y). This refactor could become challenging as decoding objects are fitted in multivariate way. Related issue: https://github.com/mne-tools/mne-python/issues/2188

    • Using EpochsVectorizer across various functions in decoding. Scikit-learn object requires data to be 2-D. Therefore as an usability improvement, EpochsVectorizer should be called internally.

    • Make all decoding functions compatible with Scikit-Learn. EMS doesn't follow Scikit-Learn API, therefore this would require total refactoring. This falls in line with the first goal.

  2. Implementation of a systematic i/o for decoding objects. Currently there is no uniform mechanism to store the classifiers and the predicted values. pickle provides a nice way to store python objects, although is extremely slow for time-gen module and an API change would make it tough to unpickle. Related issue:https://github.com/mne-tools/mne-python/issues/2189

  3. The visualization of several decoding classes also needs to be enhanced. This will involve writing various plot functions. Aside from decoding, viz also requires work in general and also writing its documentation.

  4. Scikit-Learn provides a nice interface to chain various steps of preprocessing by using Pipeline. This also makes easier to perform grid-search over parameters. Here the aim would be to make it possible for various transformers, using decoding module to be compatible with sklearn.pipeline. Therefore it should be possible to preprocess using:

    make_pipeline(Filter(10, 30), Covariances(method='shrunk'),
                   Xdawn(n_components=4), TangentSpace(),
                   SVM(kernel='linear'))
    

Refactoring would require a good deal of knowledge about the current code base therefore I believe it would be of best interest to go for i/o and visualization improvement first. This will help me learn about the decoding module which will in turn help in refactoring later.

Detailed Time-line

22 April - 22 May

Read documentation of MNE and Scikit-Learn. Study about related topics of EEG and machine learning algorithms. Make future goals clear, update or change schedule after discussing various strategies with mentor. Also a good time to solve related bugs.

23 May - 5 June

First phase of project. I plan to use this time to implement a systematic i/o operations for decoding objects. Prior to this, a healthy discussion is needed with the mentor, on how the estimators and predicted values should be stored. Desired outcome could be:

gat = GAT(..)
gat.fit(..).score()
gat.save(fname)
gat = GeneralizationAcrossTime(fname)

This will be accompanied by tests and initial documentation.

6 June - 19 June

Begin working on visualization of decoding methods. This will be an initial work which should be followed later once refactoring is done.

20 June - 30 June

I plan to use this period to work on EpochsVectorizer. This should not be a lengthy task as, if I am assuming correctly, the function needs to be called in various functions to transform the data.

1 July - 15 July

Start working on refactor of GAT and EMS and make it compatible with Scikit-Learn API. This will be challenging and would require a good deal of discussion before proceeding. The aim should be to do something like: cross_val_score(GAT)

16 July - 31 July

Make all decoding objects compatible with Scikit-Learn API. For example EMS doesn't currently inherit sklearn.base classes.

1 Aug - 10 Aug

Make sure everything is working as expected. Ensure tests cases pass and each function is covered. Also a good time for writing detailed documentation.

11 Aug - 27 Aug

Work on rest of MNE transformers, to use decoding module to pipe various steps. As I am quite unsure how much time above tasks might take, this could be completed during or after GSoC.