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

Update README.md #2

Open
wants to merge 56 commits into
base: iss1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
5e69351
Update README.md
lalou97 Jul 30, 2021
ab94a00
Update README.md
lalou97 Jul 30, 2021
2a03ee0
Update README.md
lalou97 Aug 6, 2021
f0d5a14
Update README.md
lalou97 Aug 6, 2021
b8c23e4
Update README.md
lalou97 Aug 6, 2021
c4b2e3d
Update README.md
lalou97 Aug 19, 2021
ce7776f
Update README.md
lalou97 Aug 19, 2021
bbd5bd0
Create notebook.ipynb
lalou97 Aug 19, 2021
f41e7c9
Update README.md
lalou97 Aug 19, 2021
a70a9e0
Update README.md
lalou97 Aug 19, 2021
5154e3c
Update README.md
lalou97 Aug 19, 2021
b0cec4e
Update README.md
lalou97 Aug 19, 2021
e73c792
Rename notebook.ipynb to Nimare
lalou97 Aug 19, 2021
a9f7361
Add files via upload
lalou97 Aug 19, 2021
bbf94ce
Delete Meta Needs vs Wantings -NiMARE.ipynb
lalou97 Aug 19, 2021
6fca015
Add files via upload
lalou97 Aug 19, 2021
3936cde
Add files via upload
lalou97 Aug 19, 2021
ebad1b7
Update README.md
lalou97 Sep 1, 2021
8d9fcff
Update README.md
lalou97 Sep 1, 2021
253deb0
Update README.md
lalou97 Sep 1, 2021
646b6d3
Update README.md
lalou97 Sep 3, 2021
19bd49a
Delete Meta Needs vs Wantings -NiMARE.ipynb
lalou97 Sep 3, 2021
33d51b7
Delete Needs vs Wantings 2.0.ipynb
lalou97 Sep 3, 2021
293563d
Delete Nimare
lalou97 Sep 3, 2021
b69bb86
Create Jupyter notebook
lalou97 Sep 3, 2021
adf95d3
Delete Jupyter notebook
lalou97 Sep 3, 2021
71c2611
Add files via upload
lalou97 Sep 3, 2021
cf204e9
Delete Needs vs Wantings 2.0.ipynb
lalou97 Sep 3, 2021
4c93535
Create Need vs Wants
lalou97 Sep 3, 2021
218e50f
Create All coordinates
lalou97 Sep 3, 2021
da36d9c
Add files via upload
lalou97 Sep 3, 2021
9e5535e
Update README.md
lalou97 Sep 3, 2021
110faf7
Update README.md
lalou97 Sep 3, 2021
aa641d4
Delete Need vs Wants
lalou97 Sep 3, 2021
9ba6fce
Add files via upload
lalou97 Sep 3, 2021
99bec3c
Delete Capture d’écran, le 2021-09-03 à 14.35.18.png
lalou97 Sep 3, 2021
92610a4
Add files via upload
lalou97 Sep 3, 2021
704a06a
Update README.md
lalou97 Sep 3, 2021
364f137
Add files via upload
lalou97 Sep 3, 2021
97996be
Update README.md
lalou97 Sep 3, 2021
1d30476
Update README.md
lalou97 Sep 3, 2021
c466e20
Add files via upload
lalou97 Sep 3, 2021
af7cc2a
Delete All coordinates
lalou97 Sep 3, 2021
61c017e
Update README.md
lalou97 Sep 3, 2021
f04c581
Update README.md
lalou97 Sep 3, 2021
c5b1aad
Update README.md
lalou97 Sep 3, 2021
4cdf019
Add files via upload
lalou97 Sep 3, 2021
b0213c1
Add files via upload
lalou97 Sep 3, 2021
4f96a46
Add files via upload
lalou97 Sep 3, 2021
cccab9f
Update README.md
lalou97 Sep 3, 2021
a050e2d
Delete Feature importance.mov
lalou97 Sep 3, 2021
9ab826e
Add files via upload
lalou97 Sep 3, 2021
ce58827
Update README.md
lalou97 Sep 3, 2021
fe740a3
Add files via upload
lalou97 Sep 3, 2021
8d8d1cf
Update README.md
lalou97 Sep 3, 2021
bf427a1
Update README.md
lalou97 Sep 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,479 changes: 2,479 additions & 0 deletions Jupyter notebook/Notebook_Classification_needs_wants.ipynb

Large diffs are not rendered by default.

151 changes: 147 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,147 @@
# lgrenier_project
BIO
My name is Laurence, I am a master student in psychology at Montreal University.
I am interested in social neurosciences and cognitive neuroscience.
# Using ALE algorithm and machine learning to classify need and desire states

### Personal background

##### My name is Laurence and I've completed a bachelor's degree in cognitive neuroscience at Montreal University. I am currently a master student in psychology at Montreal University. I am particularly interested in social neurosciences, thereby working at the NeSC (Neuroscience en contextes sociaux)lab. My master project is a coordinate based meta-analysis on social hierarchy.

##### I really wish to contribute to scientific findings by adopting approaches that consider the current issues of reproductibility and social inclusion in neuroscience! I've decided to do brainhack school in order to familiarize myself with coding and neuroimaging datas.



<a href="https://github.com/lalou97">
<img src="https://avatars.githubusercontent.com/u/87998890?v=4" width="100px;" alt=""/>
Copy link

Choose a reason for hiding this comment

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

consider updating your avatar on github. This avatar is used in various places, including here, so it is less confusing if you do not use the default. It does not have to be a picture though, lots of people use cartoons and brain images in lieu of an avatar.

<br /><sub><b>Laurence Grenier</b></sub>
</a>

* * *

# Project Definition
* * *

## Using ALE algorithm and machine learning to classify need and desire states


### Theoritical background
* * *
##### Overconsumption is associated with several environmental, social and individual problems (Lipschutz, 2001). One explanation suggested for overconsumption is that "we consume what we want belong what we need" (Stearns, 2006), (Juvénal et al., 2021). Some stimuli are sought for their survival value (food, water,...), while others are sought for their reward value (money, interesting objects,...). While motivation towards the former seems to increase, or even be triggered, by a state of deprivation, motivation towards the latter seems to increase as a function of the previously learned value of the stimulus, corresponding to the association between this stimulus and a reward. However, since a stimulus can be pursued for its *needing* value **AND** for its *wanting* value, for example some kind of food, or even some activities, we can wonder what are the similarities and the differences between those two conditions at a neural level?


##### To answer this question, we previously made a coordinate-based meta-analysis with the ALE (Activation likelihood estimation) algorithm in order to find the consistent activations reported in the litterature for each of those conditions. Therefore, we identified regions more commonly reported in the experiments regarding *needs* than in the expriment of *wantings*, vice versa.

#### ALE
* * *
##### The ALE approach is used to show the convergence between the regions reported in the litterature of a specified topic. For each of the selected studies, the coordinates of the significant voxels are taken (activation peaks). Then, the algorithm is making a gaussian matrice representing the spatial uncertainty, based on the sample of the corresponding study, around the activation peaks reported and thus making what is call a *MA map (main activation map)*.Therefore, each of the experiment has it own *MA map* where each voxels is associated with an activation probability (that increase in the closest to the peaks).Then, the union of the MA maps are taken and the algorithm is making permutations to identify which activations peaks are significantly reported across the experiments, thus representing the convergence of activations.

###### [Acar, F et al.,2018](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0208177)


[![ALE description!](https://github.com/PSY6983-2021/lgrenier_project/blob/lalou97-patch-iss1-add-bio/images/Step-by-step-overview-of-the-ALE-algorithm-From-an-entire-Statistical-Parametric-Map.png)](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0208177)



### Objectives
* * *

##### The goal of the present project is to build a machine learning model which will make the distinction between the studies focusing on the *needs* and the studies focusing on the *wantings* based on the MA maps generated by ALE algorithm during the first step.

##### The puposes of this project are :
##### - Build a machine learning model which will classify the *needs* and the *wants* state based on studies included in the meta-analysis to train the model.
##### - Retrieve the most contributing features in the machine learning classification model and interpret the coefficient's value in comparison of ALE meta-analysis results.
##### - Familiarize myself with open science pratices, programming and machine learning.


### Tools
* * *
##### - Python
##### - Jupyter notebooks
##### - [nilearn](https://nilearn.github.io/index.html#)
##### - [scikit-learn](https://scikit-learn.org/stable/index.html)
##### - github
##### - [nimare](https://nimare.readthedocs.io/en/latest/about.html)


### Data
* * *

#### The dataset is composed of all the activation peaks of included studies in the meta-analysis.

### *needs* : 38 studies
##### Contrasts of interest were meeting those criterions:
##### - Perception of a food stimulus during a hunger state > perception of a stimulus during a satiety state.
##### - Perception of a food stimulus during a hunger state > perception of a non-food stimulus during a hunger state.

### *wantings* : 33 studies
##### Contrasts of interest were meeting those criterions:
##### - Perception of a cue announcing a reward (or a larger reward) > perception of a cue not announcing a reward (or a smaller reward).

#### Here's all the coordinates of the sample in the brain.
### - Green : Needs
### - Red : Wants
![coordinates gif!](https://github.com/PSY6983-2021/lgrenier_project/blob/lalou97-patch-iss1-add-bio/images/All_coordinates_Enregistrement%20d%E2%80%99e%CC%81cran%2C%20le%202021-09-02%20a%CC%80%2015.32.05%20(1).gif)


### Deliverables
* * *
#### At the end of this project, I'll get :
##### - Markdown README.md for the description of the present project
##### - Jupyter notebook including the code, and the brain images


# Results
* * *
#### Summary
![Brief description!](https://github.com/PSY6983-2021/lgrenier_project/blob/lalou97-patch-iss1-add-bio/images/Model_description.png)

### Data preparation
#### - Transform all of the activation peaks of each study into a MA map with [nimare](https://nimare.readthedocs.io/en/latest/about.html).This ended up with 71 MA map, because 71 studies had been included.
#### - Apply a mask to select the voxels of the grey matter. I used the [MNI152 mask](https://nilearn.github.io/modules/generated/nilearn.datasets.load_mni152_brain_mask.html)

##### Here is an example of a MA maps with the mask:
![Ma map example!](https://github.com/PSY6983-2021/lgrenier_project/blob/lalou97-patch-iss1-add-bio/images/MA%20map%20of%20the%20first%20study-need.png)


### Machine learning
##### I used a [linear support vector classification](https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html) to build the model.

##### At first, the model classified all the data into *needs*. This problem occurred *maybe* because the value of most of the voxels is zero, or close to zero (as you can notice in the above MA map). By arranging the data in order to increase the gap between the null voxels and the non-zero ones, the classification has been improved.

##### Finally, the model predicted the data with an accuracy of 83.3 ± 16.6 %.
#### There are the confusion matrices that shows the results:
![Confusion matrice](https://github.com/PSY6983-2021/lgrenier_project/blob/lalou97-patch-iss1-add-bio/images/Confusion%20Matrices.png)

#### Interpretation
##### Even if the accuracy is quite good, because the dataset contains more *needs* than *wants*, the model have initially more than 50% of accuracy if it classifies all the datas into *needs*. Therefore, we should be careful with the interpretation of that accuracy value. This also explains why the model never classifies the *needs* into *wants* and why it is only making errors by classifying the *wants* into *needs*. A solution to overcome this problem would be to balance the weight of the different conditions according to the proportions in the dataset.

##### Moreover, I've split the data into training set and test set by myself with a proportion of 75% for the training set and 25% for the test set, and I've split again the training set into 60% training set and 40% validation set. Thus, the model is not optimal, because it is only learning with 45% of the initial dataset, which is quite small when having 71 datas. A cross-validation method would have been more efficient in that case.



#### Features importance
##### There you can see the most contributing features on the brain. The more the region is *yellow clear*, the more changes in the value of that voxel influence the decision of the model.
![Feature importance](https://github.com/PSY6983-2021/lgrenier_project/blob/lalou97-patch-iss1-add-bio/images/feature_importance.gif)


## Tools I learned during this project
* * *
###### - Python
###### - Packages to run machine learning with scikit-learn
###### - Packages ro run meta-analysis on python with nimare
###### - Tools to create great brain images and data visualization (matplotlib, seaborn...)

# Conclusion
* * *
##### In conclusion, the objectives of my project are mostly reach. Even if the model is not optimal and few modifications should be applied to improve it's validity, I've succeeded in building a machine learning model and in formatting the initial datas so the model can process them.

##### Finally, I've started this course without a significant background in coding and a little fear about it (I admit). One of my motivation to do brainhack school was to demystify this field in order to be ready to make great neuroscience! I'm glad I did it, learned python and many useful packages to analyse and play with neuroimaging datas.

##### I really want to thank BrainHack School team for their remarkable competence and exceptional support during all the course!
![Thank you!](https://github.com/PSY6983-2021/lgrenier_project/blob/lalou97-patch-iss1-add-bio/images/Capture%20d%E2%80%99e%CC%81cran%2C%20le%202021-09-03%20a%CC%80%2017.18.42.png)


### References
* * *
###### [L. Charbonnier, F. van Meer, A.M. Johnstone, D. Crabtree, W. Buosi, Y. Manios, O. Androutsos, A. Giannopoulou, M.A. Viergever, P.A.M. Smeets, Effects of hunger state on the brain responses to food cues across the life span,NeuroImage,Volume 171,2018,Pages 246-255,ISSN 1053-8119,https://doi.org/10.1016/j.neuroimage.2018.01.012.](https://neurovault.org/collections/3235/)

###### [Simon B. Eickhoff, Danilo Bzdok, Angela R. Laird, Florian Kurth, Peter T. Fox, Activation likelihood estimation meta-analysis revisited, NeuroImage, Volume 59, Issue 3, 2012,Pages 2349-2361,ISSN 1053-8119, https://doi.org/10.1016/j.neuroimage.2011.09.017.](https://www.sciencedirect.com/science/article/abs/pii/S1053811911010627?via%3Dihub)

###### [Assessing robustness against potential publication bias in Activation Likelihood Estimation (ALE) meta-analyses for fMRI, Acar F, Seurinck R, Eickhoff SB, Moerkerke B (2018) Assessing robustness against potential publication bias in Activation Likelihood Estimation (ALE) meta-analyses for fMRI. PLOS ONE 13(11): e0208177. https://doi.org/10.1371/journal.pone.0208177](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0208177)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Confusion Matrices.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/MA map of the first study-need.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Model_description.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/feature_importance.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.