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

decay for sigma can be improved #184

Open
BrandonGarciaWx opened this issue Apr 4, 2024 · 2 comments
Open

decay for sigma can be improved #184

BrandonGarciaWx opened this issue Apr 4, 2024 · 2 comments

Comments

@BrandonGarciaWx
Copy link
Contributor

Hey,

I have a few small tweaks to the MiniSom class that should help users stick to the best SOM practices.

  1. I suggest removing the following code from the "__init__" constructor method:
    if sigma >= x or sigma >= y: warn('Warning: sigma is too high for the dimension of the map.')
    Oftentimes, it is useful to have sigma equal to the hypotenuse of the SOM during the first round of training so that all neighboring nodes are significantly updated towards the beginning of the training. Using a sigma value equal to the hypotenuse of a 3x4 SOM (which is 5) would currently yield this warning despite it being a safe practice.

  2. For the "__init__" constructor method, I suggest breaking up the "decay_function" argument into separate decay functions for the learning rate and radius of influence. My reasoning for this is that typical SOM practices often call for the learning rate to decrease to a value of zero by the end of the training session. However, decaying sigma to zero often results in overfitting.
    I suggest using an inverse function like learning_rate(t) = learning_rate / (1 + 100(t/num_iteration)) for the default learning rate decay function (similar to the inverse-time function under the "alpha_type" parameter on page 14 of the attached SOM_PAK document SOMPAK_1996.pdf).
    A common practice for avoiding this overfitting is to decrease sigma to a value of one by the end of the training session instead of zero (similar to the description under the "radius" parameter on page 13 of the attached SOM_PAK document SOMPAK_1996.pdf). I suggest using an inverse function like sigma(t) = sigma / (1+t/(num_iteration/(hypotenuse - 1)) for the default sigma decay function.
    The current default decay function struggles to converge on solutions for sigma values greater than 3 due to the sigma at the end of the training being larger than 1 which results in less fine-scale tuning that usually occurs when the sigma value is near a value of 1.

Thank you for your consideration!

@JustGlowing
Copy link
Owner

These are great suggestions, would you like to raise a pull request implementing them?

@JustGlowing
Copy link
Owner

Never mind, I just pushed an update that allows you to pick a different decay function for sigma and implemented the functions mentioned in the sompak documentation you linked.

@JustGlowing JustGlowing changed the title Better Practices for MiniSom Class decay for sigma can be improved Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants