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

speed up in update method #33

Merged
merged 2 commits into from May 30, 2019
Merged

Conversation

Sourmpis
Copy link

Hi! Thanks for sharing the library!
I noticed that if you change the loop in the update method with an einsum operation you can speed up the training by some amount.
Hope you find it useful.
Christos

@JustGlowing
Copy link
Owner

Thanks for your contribution @Sourmpis !

I'm also working on speeding up minisom, but I'm more looking into using numba. What sort of speedup did you achieve with einsum?

@Sourmpis
Copy link
Author

Happy if this is helpful! Numba sounds really good.
Using einsum, basically you avoid doing the multiplication of g neighborhood matrix and the matrix x_w = x - self._weights in a loop but instead you doing it in numpy.

@JustGlowing
Copy link
Owner

Of course, did you measure the speed up? Is it 2x, 4x, ... ?

@Sourmpis
Copy link
Author

sorry i misunderstood the question, the speedup is around x2.5

@JustGlowing
Copy link
Owner

That is amazing!

Can you fix the following codestyle issues?

$ pycodestyle minisom.py 
minisom.py:5:80: E501 line too long (84 > 79 characters)
minisom.py:249:5: E303 too many blank lines (3)

@Sourmpis
Copy link
Author

just did it :)

@JustGlowing
Copy link
Owner

Thanks @Sourmpis ! I'll now merge this and you'll be mentioned in the release notes of the new version of minisom ;-)

@JustGlowing JustGlowing merged commit 0a26419 into JustGlowing:master May 30, 2019
@Sourmpis
Copy link
Author

Thank you!

Manciukic pushed a commit to Manciukic/xpysom that referenced this pull request Jun 28, 2020
@JustGlowing
Copy link
Owner

hi there, I'm thinking about changing the license of Minisom to MIT (or GPL). This will allow Minisom to have a paper on the Journal of Open Source software. This WILL NOT affect the ownership of your contribution and does not imply that I will profit from Minisom. Your contribution was very welcome and I'd like to have your approval.

@Sourmpis
Copy link
Author

Sourmpis commented Jul 23, 2020 via email

JustGlowing added a commit that referenced this pull request Apr 26, 2021
speed up in update method
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

2 participants