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

Proper interpretation of the bubble neighborhood function and sigma #61

Open
AWSisco opened this issue Jan 28, 2020 · 10 comments
Open

Proper interpretation of the bubble neighborhood function and sigma #61

AWSisco opened this issue Jan 28, 2020 · 10 comments
Labels

Comments

@AWSisco
Copy link

AWSisco commented Jan 28, 2020

I have a question regarding the bubble neighborhood function and how to interpret the value of sigma. Take the following SOM, for example:

som = MiniSom(x = 4, y = 3, input_len = 1000, sigma = 3, learning_rate = 0.05, neighborhood_function = "bubble")

This triggers a warning since sigma >= y, and minisom.py does note that sigma should be an odd integer for the bubble neighborhood function but I'm not entirely sure why. Is sigma for the bubble function just the radius from the winning node? E.g., if instead I set sigma = 1, would that mean just the immediately neighboring nodes of the winner are updated? After sigma decreases to less than 1, is only the winning node updated?

Thanks so much for any clarification you can provide!

@JustGlowing
Copy link
Owner

JustGlowing commented Jan 29, 2020

hi Adam,

You get that warning because the current implementation of the bubble and triangle functions doesn't center the values properly when sigma is even.

If sigma=1 only the winning node is updated if you use bubble or triangle, This strategy is called "winner takes all" (Haykin 1999). With gaussian and mexican_hat the neighbours of the winner will still have a small update. If sigma<1 one gaussian and mexican_hat will only update the winner but bubble or triangle will not work.

@AWSisco
Copy link
Author

AWSisco commented Jan 29, 2020

Thank so much @JustGlowing. That clears up sigma=1 for me.

However, you say above that bubble does not center properly when sigma is odd, but I'm still confused since lines 208-211 in minisom.py seem to state that sigma should be odd.

def _bubble(self, c, sigma):
        """Constant function centered in c with spread sigma.
        sigma should be an odd value.
        """

@JustGlowing
Copy link
Owner

My bad, I meant when sigma is even. I also corrected my first answer for future readers.

@omerbt
Copy link

omerbt commented Aug 31, 2020

hi Adam,

You get that warning because the current implementation of the bubble and triangle functions doesn't center the values properly when sigma is even.

If sigma=1 only the winning node is updated if you use bubble or triangle, This strategy is called "winner takes all" (Haykin 1999). With gaussian and mexican_hat the neighbours of the winner will still have a small update. If sigma<1 one gaussian and mexican_hat will only update the winner but bubble or triangle will not work.

I trained the model with 'gaussian' and sigma = 0.8,0.6,0.4,0.2, and the results I get are completely different (all other parameters were not changed, and I use the same random seed). How are different values [that are all <1] change the training process?

@JustGlowing
Copy link
Owner

hi @omerbt small changes in sigma can have big impacts on the results of training even when sigma is kept below 1. It all depends on the size of the map and the data that you have.

@omerbt
Copy link

omerbt commented Aug 31, 2020

Hi, thank you for the answer. just to make sure I get it right - isn't sigma only relevant for the choice of neurons to update in each step?

@JustGlowing
Copy link
Owner

Yes, sigma is the spread of the neighbourhood function. The bigger sigma, the more bigger the neighbourhood that will be affected by the training step.

@omerbt
Copy link

omerbt commented Sep 1, 2020

So if sigma < 1 implies updating only the winner, then why should I expect different values in that range to lead to different results (since anyway only the winner will be updated)? thanks

@JustGlowing
Copy link
Owner

If sigma < 1 you don't update only the winner but also other neurons by just a small amount. If you want to update only the winner you can user the triangle function with sigma=1.

@omerbt
Copy link

omerbt commented Sep 1, 2020

great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants