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

ENH: Speeding up ST clustering by 30% #195

Closed
wants to merge 2 commits into from

Conversation

larsoner
Copy link
Member

This increases code complexity a little bit, but it makes spatio-temporal clustering 30% faster. We can decrease code complexity back to old levels if we remove the max_step option (because then we can remove the slower method _get_clusters_st), which I don't expect to be a terribly popular option anyway and mostly included for completeness before.

@larsoner
Copy link
Member Author

...but don't merge quite yet. A) I thought of another modification that may speed it up that I want to try, and B) I want to see what people (ahem @agramfort) think about removing the max_step option from clustering.

if max_step == 1:
clusters = _get_clusters_st_1step(x_in, connectivity)
else:
clusters = _get_clusters_st(x_in, connectivity, max_step)
Copy link
Member

Choose a reason for hiding this comment

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

It seems more natural to have _get_clusters_st carrying the logic if max_step == 1 etc.

also are these lines covered by a test as I don't see any test modified.

@mluessi
Copy link
Contributor

mluessi commented Nov 27, 2012

I looks good (but complicated ;-)) We should have a test that compares _get_clusters_st_1step with _get_clusters_st using max_step=1 as they should give the exactly same result, right?

@larsoner
Copy link
Member Author

Fixed the function choosing as suggested by @agramfort, and added nosetests as required. Also, I sped up the nosetests by a factor of ~5 by doing 100 instead of 500 permutations (why bother).

@larsoner
Copy link
Member Author

I don't think the idea I had that I mentioned earlier to speed things up further will pan out, so I'm fine with merging this for now.

@agramfort
Copy link
Member

merged by rebase after a tiny "cosmit"

I checked the test coverage of cluster_level.py and I think we can do better. Just saying...

@agramfort agramfort closed this Nov 27, 2012
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

3 participants