Skip to content

Deterministic SRM - #102

Merged
mihaic merged 17 commits into
brainiak:masterfrom
TuKo:deterministicsrm
Sep 21, 2016
Merged

mihaic merged 17 commits into
brainiak:masterfrom
TuKo:deterministicsrm

Conversation

@TuKo

@TuKo TuKo commented Sep 14, 2016

Copy link
Copy Markdown

Added the Deterministic Shared Response Model to Functional Alignment methods:

  • Added tests
  • Modified examples (python & notebook) to run with both Probabilistic and Deterministic SRM.

@mihaic

mihaic commented Sep 14, 2016

Copy link
Copy Markdown
Member

@cameronphchen Could you please review this PR?

Comment thread brainiak/funcalign/srm.py
"""Shared Response Model (SRM)

This implementation is based on the following publications:
The implementations are based on the following publications:

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 change the second reference to our Arxiv paper?
https://arxiv.org/abs/1608.04647

@cameronphchen

Copy link
Copy Markdown
Contributor

@mihaic @TuKo Sure, I'll review this.

@cameronphchen cameronphchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks Javier!! Overall it looks good to me. I have added a comment on a new test case and some other minor comments.

Comment thread brainiak/funcalign/srm.py
self.verbose = verbose
return

def fit(self, X, y=None):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if y is not used, why not remove it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is the interface for fit in BaseEstimator in scikit-learn.

Comment thread brainiak/funcalign/srm.py
number of samples must be the same across subjects.

The Deterministic Shared Response Model is approximated using the
Block Coordinate Descent (BCD) algorithm proposed in [Chen2015]_.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we remove the _ after [Chen2015]?

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.

That creates a link in the HTML version:
http://pythonhosted.org/brainiak/brainiak.funcalign.html

Comment thread brainiak/funcalign/srm.py
X : list of 2D arrays, element i has shape=[voxels_i, samples]
Each element in the list contains the fMRI data of one subject.

y : not used

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same here, if y is not used, why not remove it?

Comment thread brainiak/funcalign/srm.py Outdated
for m in range(subjects):
objective += \
(np.linalg.norm(data[m] - w[m].dot(s), 'fro')**2)\
* (0.5 / data[m].shape[1])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we need this? since data[m] for all subjects should have the same number of TRs. and this is checked at the beginning of entering DetSRM.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Will change it.

Comment thread brainiak/funcalign/srm.py Outdated

This is a single node version.

The run-time complexity is :math:`O(I (V T K))` and the memory

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this the complexity for matrix multiplication only? We would also need to incorporate the complexity of SVD.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Correcting this one...

except ValueError:
print("Catched Exception number 2: different number of samples per subject")


@cameronphchen cameronphchen Sep 15, 2016 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we add a test with the synthetic data to make sure the output of DetSRM is consistent. To be specific, a test to check that the output Ws are all orthonormal and W_i*S are close to input X within a threshold delta. This doesn't have to be in this PR but it's necessary to have one in case some future editing break the code.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've added the orthogonality check for both SRM and DetSRM.
Added also the other test, but it is difficult to say what is the right delta.

@TuKo

TuKo commented Sep 20, 2016

Copy link
Copy Markdown
Author

@cameronphchen, please check the modifications and let us know if everything is fine.

@cameronphchen cameronphchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thanks for the revision!

@mihaic
mihaic merged commit e010328 into brainiak:master Sep 21, 2016
@TuKo
TuKo deleted the deterministicsrm branch September 28, 2016 23:52
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