Skip to content

Distributed srm - #220

Merged
mihaic merged 14 commits into
brainiak:masterfrom
mjanderson09:distributed_srm
May 11, 2017
Merged

mihaic merged 14 commits into
brainiak:masterfrom
mjanderson09:distributed_srm

Conversation

@mjanderson09

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread brainiak/funcalign/srm.py
The estimated noise variance :math:`\\rho_i^2` for each subject

comm_ : mpi4py.MPI.Intracomm
The MPI communicator containing the 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.

comm should be used instead of comm_ everywhere, because it is given as a parameter, not computed from data:
http://scikit-learn.org/stable/developers/contributing.html#instantiation
http://scikit-learn.org/stable/developers/contributing.html#estimated-attributes

Comment thread brainiak/funcalign/srm.py Outdated

for subject in range(subjects):
mu.append(np.mean(data[subject], 1))
np.random.seed(subject)

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 does this interact with self.rand_seed?

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.

Not addressed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Check issue #114
Is it right to initialize the distributed SRM randomly?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed this random seed per subject code. Instead, each SRM class instantiation can set a random seed (as before). This means for multiple ranks, each rank can potentially set a different seed. I don't think we can guarantee exactly deterministic results for the distributed implementation due to differences in parallel scheduling per run.

Comment thread tests/funcalign/test_srm.py Outdated
print("Test: different number of samples per subject")


test_can_instantiate()

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.

Wrap this call in if __name__ == "__main__", please.

@mihaic
mihaic requested a review from TuKo April 28, 2017 20:13
@mihaic

mihaic commented May 1, 2017

Copy link
Copy Markdown
Member

Jenkins, retest this please.

1 similar comment
@mihaic

mihaic commented May 2, 2017

Copy link
Copy Markdown
Member

Jenkins, retest this please.

@TuKo

TuKo commented May 2, 2017

Copy link
Copy Markdown

@mjanderson09 great job!
Please, consider adding the TS-SVD and TS-QR code as well. We should allow for reproducibility of the IEEE BigData algorithm. Also, all SRM flavors will benefit from it, and some other methods as well.

Don't need to do it now. You can do it in a different PR.

Thank you!

Comment thread tests/funcalign/test_srm.py Outdated
s.fit(X)
sr_v0_4 = np.load('sr_v0_4.npy')
diff_v0_4 = np.linalg.norm(sr_v0_4 - s.s_)
assert(diff_v0_4 < 1e-5)

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.

Shouldn't the results be element-wise equal, i.e., np.allclose(sr_v0_4, s.s_), maybe with an atol value?

Comment thread tests/funcalign/test_srm.py Outdated

# Check that runs with 2 subject
s.fit(X)
sr_v0_4 = np.load('sr_v0_4.npy')

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.

Add this to imports:
from pathlib import Path

Then:
Path(__file__).parent / "sr_v0_4.npy"

@mihaic

mihaic commented May 10, 2017

Copy link
Copy Markdown
Member

@TuKo, what say you?

@TuKo

TuKo commented May 10, 2017

Copy link
Copy Markdown

@TuKo says NIPS, sorry...

Comment thread tests/funcalign/test_srm.py Outdated
print("Test: different number of samples per subject")


test_can_instantiate()

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 guard this call with if __name__ == "__main__".

@TuKo

TuKo commented May 11, 2017 •

Copy link
Copy Markdown

👍 Great work!

@mihaic
mihaic merged commit 3e039bd into brainiak:master May 11, 2017
@mihaic

mihaic commented May 11, 2017

Copy link
Copy Markdown
Member

For the record, here is the effect of the changes on the accuracy in the image prediction example:

v0.4:
SRM: The average accuracy among all subjects is 0.657143 +/- 0.058576
Det. SRM: The average accuracy among all subjects is 0.657143 +/- 0.070891

master (i.e., per-subject random number generators):
SRM: The average accuracy among all subjects is 0.664286 +/- 0.076097
Det. SRM: The average accuracy among all subjects is 0.673214 +/- 0.068721

distributed_srm:
SRM: The average accuracy among all subjects is 0.664286 +/- 0.076097
Det. SRM: The average accuracy among all subjects is 0.673214 +/- 0.068721

danielsuo pushed a commit that referenced this pull request Nov 16, 2017
#220)

* Added test for retriving variables from an optimizer

* Added comments to test

* Addressed comments

* Fixed travis bug

* Added fix to circular controls

* Added set for explored operations and duplicate prefix stripping

* Removed embeded ipython

* Removed prefix, use seperate graph for each network

* Removed redundant imports

* Addressed comments and added separate graph to initializer

* fix typos

* get rid of prefix in documentation
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