JoseAlanis's Blog

Check-in: 3rd week of GSoC (June 10 - June 16)

Published: 06/17/2019

1. What did you do this week?

This week, I continued working on a script that looks at altenative methods for fitting a linear model to data from a single subject (i.e. "first level" analysis).

  • In particular, I focussed on using the linear_model module from SciKit Learn to replicate the functionality of the current linear_regression function provided by MNE-Python (see this PR on my project's sandbox repository on GitHub for further details).


2. What is coming up next?

  • During the upcoming week I'll be working with Stefan Appelhoff, another GSoC student working with MNE-Python this summer. We'll focus on restructuring the LIMO dataset to comply with the Brain Imaging Data Structure (BIDS) specification. BIDS refers to a set of standards used for organizing and sharing brain imaging study data within and between laboratories (see the preprint on PsyArXiv), or visit Stefan's Blog to learn more about BIDS for EEG data.
  • I'll also keep working on the "second-level" analysis (i.e., group-level inference) part of my GSoC Project.


3. Did you get stuck anywhere?

 This week was a little bit slow, but I didn't feel like I got stuck with anything in particular.

I'm definitely looking forward to working with Stefan on the BIDS adaption of the LIMO dataset and making some progress on the second-level analysis part of my project.

View Blog Post

Blog post: 2nd week of GSoC (June 3 - June 9)

Published: 06/10/2019

1. What did you do this week?

This week I focused on putting up a GitHub repository for my GSoC project and adding some example code and auxiliary functions that will help me test and validate additions to MNE-Python’s API.

Furthermore, I made improvements to the code featured in last week’s post and extended  some of it’s features.

Here a quick summary of this week’s progress:

  1. Set up MNE-stats repository on GitHub.
  2. Add plot_design_matrix function for visualization of design matrices.
  3. Add example code for the inspection of group-level effects in the LIMO dataset.
  4. Propose changes to mne.stats.linear_regression function (e.g., fitting of the linear model).
  5. Extend module in MNE-Python to allow download of the complete dataset.


2. What is coming up next?

Next, I'll continue extending the mne.stats.linear_regression function, mainly focusing on group level inference.

In particular I will work on the following aspects:

  1. Extend mne.stats.linear_regression function to allow for example:
    • The fitting of a "first-level" or subject-level linear model over a series of time samples and recording sites for each individual in a group,
    • Uses this first-level information to carry out inference o a "second-level" or group-level.
  2. Visualize group-level effects and confidence of prediction.
  3. Improve the "robustness" of this method, for instance, by enabling the algorithm to account for outliers in the dataset.


2. Did you get stuck anywhere?

Not really, this week was pretty straightforward and I feel like I'm getting a little bit of "flow" and progressing well with my project.

Although, going from first to second level analyses in linear regression might represent a sticking point in the project. In particular because this has rarely been implemented (at least in Python) for the analysis of entire magneto- and electro-encephalography datasets, which often include a wide variety of samples, recording sites and subjects.

View Blog Post

Overview of project and summary of first week

Published: 06/04/2019

Hello everyone,

In this post, I would like to tell you a little bit more about my Google Summer of Code (GSoC) Project and give you a quick summary of the progress I’ve made so far.


About my project.

I’m a PhD student from Germany. In my PhD work I focus on the analysis of brain activity patterns and how these are influenced by individuals' personality and other situational factors. Thus, some of the ideas for my GSoC project are, at least to some extend, rooted in issues I've come across while analyzing data, looking for ways to describe the relationship between a set variables and patterns of brain activity.

In short, the core of my project consist in developing a set of tools and tutorials that extend the capabilities for regression analysis in MNE-Python, the premier toolbox for analyzing neural time series in Python. In statistics, linear regression is typically used for describing the relationship between predictors and response variables or targets. In particular, by determining the strength of the relationship between these variables, linear regression algorithms can help identify variables and/or subsets of data that contain relevant information about the things we would like to predict (e.g., in my case, patterns of brain activity).

To date, linear regression functionality in MNE-Python is capable of handling regression designs mostly characterized by the introduction of categorical predictors based on ordinary least squares estimation. Even though this approach can be used to inspect relationships between a wide variety of predictors and targets, the limited options for specifying more complex regression models, such as those based on robust and hierarchical estimation algorithms (see for instance here) are currently preventing users from making use of the functionality of MNE’s linear regression at a larger scale, and from using more elaborated regression tools commonly implemented in multiple scientific fields for which MNE is relevant.

The major goal of my GSoC Project is to provide a certain degree of flexibility and allow users to fit different types of models in accordance to their research questions. Feel free to the visit the wiki-page on GitHub, if you’d like to learn more about the project.


What I've done so far.

During the first week of GSoC, I've worked on integrating open data resources in MNE-Python and wrote a set of functions that allow for an easy handling of these resources (see previous post and this this PR on GitHub for further details). This kind of "open data sets", are fundamental to my project, since I plan  to validate new implementations of the linear regression framework on them. Furthermore, I added some initial example code to explain linear regression functionality on the basis of this, newly integrated, data set (see here).

There were some issues along the way, specially when it came down to integrating my code in MNE's API. Thus, a big chunk of work from last week was related to fixing errors and making improvements to my code. However, I believe I learned a lot during the process and I'm looking forward to further consolidate my proposal of the API for statistical modeling in MNE-Python next week.

Stay tuned!

View Blog Post

Weekly check-in: 1st week (May 27 - June 2)

Published: 06/02/2019

1. What did you do this week?

Most of this week's work was focused on finalizing a set of functions that provide support for the LIMO dataset inside MNE-Python. The LIMO dataset is an openly available collection of files that contain neural time series data (i.e., EEG data). One goal of my GSoC project is to use this kind of open data resources for testing and validating new tools for linear regression analysis.

This week's work included:

  1. Setting up an OSF project to facilitate the download of individual files.
  2. Writing a python function that accesses OSF's API to retrieve the files.
  3. Writing a python function that brings the retrieved files into MNE-Python compatible data structures.
  4. Setting up a tutorial to explain the functionality of the added functions.
    • Here, I've included some first linear regression results to replicate analyses of the LIMO dataset, which have been documented elsewhere.
    • In addition, I started formulating a set of functions that allow the visualization of design matrices.
  5. Fixing bugs and making improvements to the code after discussion with mentors and community.


2. What is coming up next?

One important step for the next week is to create a new repository: MNE-Stats. The plan is to carry out most part of the developing work for statistical modeling tools in this repo. This way, we hope to improve flexibility during the project.

Furthermore, I aim to further consolidate my proposal of the API for statistical modeling in MNE. I will focus on the following issues during the next week:

  1. Facilitate the building of the design matrix.
    • Here, I will continue to work on these week’s code (see 4. above).
    • Handling of predictor and target variables (e.g., scaling).
    • Dealing with interaction terms and visualization of the effects.
    • Regularization and robustness of prediction.


3. Did you get stuck anywhere?

This week brought some challenging tasks, but I didn't feel particularly stuck during the process of solving them. For instance, one milestone of this week was that I was able to merge my first “big” pull request on MNE-Python. Of course, some changes I made introduced a couple of minor bugs and errors. So, from time to time, I felt like most of my work was focused on fixing errors and bringing the code to actually run smoothly. It probably sounds worse than it actually is, but I think one challenge for the next few weeks will be keep focused on the overall goal and don’t get too frustrated by errors and other issues.

View Blog Post

Hello World!

Published: 05/20/2019

Hello everyone, my name is José García Alanis from Germany. I will be participating in this year's GSoC with MNE Python, a sub-org of the Python Software Foundation and provider of the homonymous toolbox for the analysis of neural time-series data in Python. My project will focus on improving linear regression analysis in MNE-Python.

During the upcoming weeks I will be documenting my progress here, so stay tuned!

View Blog Post