minisom icon indicating copy to clipboard operation
minisom copied to clipboard

Proper interpretation of the bubble neighborhood function and sigma

Open AWSisco opened this issue 6 years ago • 10 comments

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!

AWSisco avatar Jan 28 '20 20:01 AWSisco

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.

JustGlowing avatar Jan 29 '20 09:01 JustGlowing

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.
        """

AWSisco avatar Jan 29 '20 13:01 AWSisco

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

JustGlowing avatar Jan 29 '20 13:01 JustGlowing

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?

omerbt avatar Aug 31 '20 12:08 omerbt

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.

JustGlowing avatar Aug 31 '20 19:08 JustGlowing

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?

omerbt avatar Aug 31 '20 19:08 omerbt

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.

JustGlowing avatar Sep 01 '20 06:09 JustGlowing

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

omerbt avatar Sep 01 '20 07:09 omerbt

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.

JustGlowing avatar Sep 01 '20 07:09 JustGlowing

great, thanks!

omerbt avatar Sep 01 '20 07:09 omerbt