Skip to content

Update srm.py#371

Merged
CameronTEllis merged 13 commits into
brainiak:masterfrom
CameronTEllis:patch-2
May 15, 2018
Merged

Update srm.py#371
CameronTEllis merged 13 commits into
brainiak:masterfrom
CameronTEllis:patch-2

Conversation

@CameronTEllis

Copy link
Copy Markdown
Contributor

Added code based on what is in rsrm to allow for transformation of new participant data without changing the shared response s

Added code based on what is in rsrm to allow for transformation of new participant data without changing the shared response s
@lcnature lcnature requested a review from TuKo May 4, 2018 17:04
@mihaic

mihaic commented May 4, 2018

Copy link
Copy Markdown
Member

Jenkins, retest this please.

@mihaic

mihaic commented May 4, 2018

Copy link
Copy Markdown
Member

@CameronTEllis, the Jenkins Linux failure is unrelated. I am working on it.

We need tests for the new code.

Added tests for new SRM code (transform_subject addition)

@TuKo TuKo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi Cameron,
The PR looks good.
Please pay attention to the for-loops that need to be removed.

Comment thread brainiak/funcalign/srm.py
----------

X : 2D array, shape=[voxels, timepoints]
The fMRI data of the new subject.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please add that should be under the same stimuli as the original subjects.

Comment thread brainiak/funcalign/srm.py Outdated
raise ValueError("The number of timepoints(TRs) does not match the"
"one in the model.")

for i in range(self.n_iter):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There is no need for a for here. You should call the function once.

Comment thread brainiak/funcalign/srm.py Outdated
raise ValueError("The number of timepoints(TRs) does not match the"
"one in the model.")

for i in range(self.n_iter):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There is no need for a for-loop here. You should call the function once.

Comment thread tests/funcalign/test_srm.py Outdated
assert new_s[subject].shape[1] == samples, (
"Invalid computation of SRM! (wrong # samples after transform)")


Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Let's add this as part of a new test.
Add a new test function that creates the object and tries to add the new subject

Removed fitting and added to docstring for transform_subject

@TuKo TuKo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@CameronTEllis thanks for the changes. Please add the missing lines to the test and that is for sure good enough. Thanks!

X.append(Q.dot(S) + 0.1*np.random.random((voxels, samples)))

# Check that runs with 2 subject
s.fit(X)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You should test that it does not succeed when the model is not computed before you call fit()

Added test that transforming before fit fails
@TuKo

TuKo commented May 11, 2018

Copy link
Copy Markdown

👍 Well done! @mihaic you can go ahead.

@mihaic

mihaic commented May 11, 2018

Copy link
Copy Markdown
Member

@CameronTEllis, you can merge this yourself after you get the tests to pass.

@CameronTEllis

Copy link
Copy Markdown
Contributor Author

Jenkins, retest this please.

@mihaic

mihaic commented May 15, 2018

Copy link
Copy Markdown
Member

@CameronTEllis, unfortunately, Travis does not respond to that command. Can you please login to Travis and check if you can restart the build? (I am trying to determine if Travis understands GitHub permissions for teams, but I couldn't find an answer yet.)

Increase coverage
@mihaic

mihaic commented May 15, 2018

Copy link
Copy Markdown
Member

@CameronTEllis, to cover lines 403 and 777, you should call transform_subject before fitting (you are calling transform).

Also, it seems to me you have the right and were able to rerun the build on Travis. Can you please confirm?

Increasing coverage
@CameronTEllis

Copy link
Copy Markdown
Contributor Author

@mihaic Aha thank you for that catch. Hopefully that will fix it. And yes I was able to make an account and rebuild travis thank you

@CameronTEllis

Copy link
Copy Markdown
Contributor Author

Great, looking good. Unfortunately I still don't have write access to this repo and can't merge the pull request.

@mihaic

mihaic commented May 15, 2018

Copy link
Copy Markdown
Member

My bad. Please try again. And when you write the merge message, have a look at the style of commit messages we use:
https://github.com/brainiak/brainiak/commits/master

@CameronTEllis CameronTEllis merged commit b81adac into brainiak:master May 15, 2018
@CameronTEllis CameronTEllis deleted the patch-2 branch May 15, 2018 22:46
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.

3 participants