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

Random permutation of FCMA #217

Merged
merged 10 commits into from Apr 28, 2017

Conversation

Projects
None yet
3 participants
@yidawang
Contributor

yidawang commented Apr 27, 2017

  1. add random voxel permutation to FCMA;
  2. add more debugging and information logs;
  3. minor tweak for docstring format, etc.

Thanks in advance for reviewing.

@yidawang yidawang requested a review from mihaic Apr 27, 2017

@xoltar

Thanks, Yida! Looks pretty good, just a few small changes needed.

raw_data2, _ = _separate_epochs(activity_data2, conditions)
else:
activity_data1 = list(mask_images(images, mask1, np.float32))
_randomize_subject_list(activity_data1, random)

This comment has been minimized.

@xoltar

xoltar Apr 27, 2017

Contributor

_randomize_single_subject modifies data in place (and then returns the same array). _randomize_subject_list returns a new list, containing old arrays that have been modified in place, which is why these lines work even though you're ignoring the return value. I would say either write them both to work in-place, or write them both to return new values. Mixing the two makes for confusion. If you decide you want to have _randomize_single_subject return a new array instead of working in-place, consider numpy.random.permutation instead of shuffle.

@xoltar

xoltar Apr 27, 2017

Contributor

_randomize_single_subject modifies data in place (and then returns the same array). _randomize_subject_list returns a new list, containing old arrays that have been modified in place, which is why these lines work even though you're ignoring the return value. I would say either write them both to work in-place, or write them both to return new values. Mixing the two makes for confusion. If you decide you want to have _randomize_single_subject return a new array instead of working in-place, consider numpy.random.permutation instead of shuffle.

This comment has been minimized.

@yidawang

yidawang Apr 27, 2017

Contributor

Thanks for the suggestion! Somehow I ignored the return value here although I should put it as activity_data1 = _randomize_subject_list(activity_data1, random). I would prefer working in-place, let me modify _randomize_subject_list accordingly.

@yidawang

yidawang Apr 27, 2017

Contributor

Thanks for the suggestion! Somehow I ignored the return value here although I should put it as activity_data1 = _randomize_subject_list(activity_data1, random). I would prefer working in-place, let me modify _randomize_subject_list accordingly.

Show outdated Hide outdated brainiak/fcma/preprocessing.py
Show outdated Hide outdated brainiak/fcma/preprocessing.py
Show outdated Hide outdated brainiak/fcma/preprocessing.py
Show outdated Hide outdated brainiak/fcma/preprocessing.py
Show outdated Hide outdated brainiak/fcma/voxelselector.py
Show outdated Hide outdated brainiak/io.py
Show outdated Hide outdated brainiak/fcma/preprocessing.py
Show outdated Hide outdated brainiak/io.py
Show outdated Hide outdated brainiak/io.py
Show outdated Hide outdated examples/fcma/mvpa_voxel_selection.py
Show outdated Hide outdated examples/fcma/voxel_selection.py
Show outdated Hide outdated brainiak/io.py
@mihaic

mihaic approved these changes Apr 27, 2017

yidawang added some commits Apr 28, 2017

@xoltar

xoltar approved these changes Apr 28, 2017

@xoltar xoltar merged commit 3a4c566 into brainiak:master Apr 28, 2017

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
linux Build finished.
Details
macos Build finished.
Details

@yidawang yidawang deleted the yidawang:fcma-random-permutation branch Apr 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment