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

Fcma mvpa searchlight #154

Merged
merged 10 commits into from Jan 12, 2017
Merged

Conversation

yidawang
Copy link
Member

enable activity-based voxel selection in the FCMA pipeline

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
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
Member Author

Choose a reason for hiding this comment

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

done

mask: 3D array

epoch\_info: list of tuple (label, sid, start, end)
the condition labels of the epochs
Copy link
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
Member Author

Choose a reason for hiding this comment

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

fixed


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
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
Member Author

Choose a reason for hiding this comment

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

fixed

sl: Searchlight
the distributed Searchlight object

processed\_data: 4D array in shape [brain 3D + epoch]
Copy link
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
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_.

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
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
Member Author

Choose a reason for hiding this comment

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

done

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
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
Member Author

Choose a reason for hiding this comment

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

done

logger.info(
'epoch separation done, takes %.2f s' %
(time2 - time1)
)
Copy link
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
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
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
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
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.

None yet

2 participants