Skip to content

Fcma mvpa searchlight - #154

Merged
mihaic merged 10 commits into
brainiak:masterfrom
yidawang:fcma_mvpa_searchlight
Jan 12, 2017
Merged

mihaic merged 10 commits into
brainiak:masterfrom
yidawang:fcma_mvpa_searchlight

Conversation

@yidawang

Copy link
Copy Markdown
Member

enable activity-based voxel selection in the FCMA pipeline

Comment thread brainiak/fcma/mvpa_voxelselector.py Outdated
the condition labels of the epochs
len(labels) labels equals the number of epochs
assuming the epochs of the same sid are adjacent,
and sid is the index of raw\_data

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you please explain more the meaning of sid?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

Comment thread brainiak/fcma/mvpa_voxelselector.py Outdated
mask: 3D array

epoch\_info: list of tuple (label, sid, start, end)
the condition labels of the epochs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please format this text like a normal paragraph, with sentences. Of course, you can use a bulletted list too if you think it helps.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed

Comment thread brainiak/fcma/mvpa_voxelselector.py Outdated

processed\_data: 4D array in shape [brain 3D + epoch]
contains the averaged and normalized brain data epoch by epoch
it is generated in _\preprocess\_data method

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You must not reference private APIs (_preprocess_data) in the documentation of public APIs (MVPAVoxelSelector).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed

Comment thread brainiak/fcma/mvpa_voxelselector.py Outdated
sl: Searchlight
the distributed Searchlight object

processed\_data: 4D array in shape [brain 3D + epoch]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If processed_data is not passed to __init__, it must not be documented as a parameter. How about listing it as as an attribute and adding naming it processed_data_, like in SRM?
https://github.com/IntelPNI/brainiak/blob/master/brainiak/funcalign/srm.py#L116
This would be in accordance with our coding standards:
http://scikit-learn.org/stable/developers/contributing.html#estimated-attributes

Same for labels.

On the other hand, the whole FCMA architecture does not fit our coding standards (data is passed at instantiation, instead of through fit), so maybe it is best to leave this code as it is for the moment and restructure all of FCMA later. Up to you. But note that the current list of parameters is confusing, because not all parameters listed are accepted by __init__.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The parameter list here documents the properties of MVPAVoxelSelector instead of the input of __init__. The two voxel selector of FCMA is not about fitting, so I didn't follow the standard to only pass data through fit. I agree to keep the code structure as it is and leave the restructure discussion later. For now, let me modify the properties not passed through __init__ as var_.

Comment thread brainiak/fcma/mvpa_voxelselector.py Outdated
self.mask = mask.astype(np.bool)
self.epoch_info = epoch_info
self.num_folds = num_folds
self.sl = Searchlight(sl_rad=sl_rad, max_blk_edge=max_blk_edge)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not let the user created the searchlight? Then you would not need to accept (and document) all the searchlight parameters in your __init__?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

Comment thread examples/fcma/file_io.py Outdated
epoch\_info: list of tuple (label, sid, start, end)
the condition labels of the epochs
len(labels) labels equals the number of epochs
assuming the epochs of the same sid are adjacent

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please write sentences in the docstrings. They are hard to follow without capitalization and punctuation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

Comment thread examples/fcma/file_io.py
logger.info(
'epoch separation done, takes %.2f s' %
(time2 - time1)
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't debug more appropriate for timing messages?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

example running command:
mpirun -np 2 python mvpa_voxel_selection.py /Users/yidawang/data/face_scene/raw nii.gz /Users/yidawang/data/face_scene/mask.nii.gz
data/fs_epoch_labels.npy 18
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about providing some sample data like in SRM?
https://github.com/IntelPNI/brainiak/blob/master/examples/funcalign/download-data.sh

If the files are small enough (a few kB), you can even add them to Git.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, how about making a shell script with the command, like for HTFA?
https://github.com/IntelPNI/brainiak/blob/master/examples/factoranalysis/run_mpi_htfa.sh

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

good idea, done

@mihaic
mihaic merged commit 1bd49d4 into brainiak:master Jan 12, 2017
@yidawang
yidawang deleted the fcma_mvpa_searchlight branch January 12, 2017 06:19
danielsuo pushed a commit that referenced this pull request Nov 16, 2017
danielsuo pushed a commit that referenced this pull request Nov 16, 2017
* Improve formatting of error messages.

* Catch errors that occur when looking up function name from function ID.

* Push warning to user if worker spends to long waiting for proper import counter.

* Fixes.

* Add comment.
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.

2 participants