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 Function Improvements #185

Merged

Conversation

BrandonGarciaWx
Copy link
Contributor

@BrandonGarciaWx BrandonGarciaWx commented Apr 16, 2024

  • Changed names of decay functions to specify which should be used for learning rate and which should be used for sigma. This avoids confusion where a decay function meant for the learning rate could be used by users to decay sigma and thus potentially lead to overfitting.
  • Replaced default sigma value with the hypotenuse of the SOM as this is a common starting sigma value that helps SOMs converge on global minimum. This avoids users picking small sigmas that erroneously converge on local quantization error minima.
  • Replaced the asymptotic_decay function with the sigma_inverse_time_decay function. This new function always decays to a value of 1 to avoid overfitting. The asymptotic_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.
  • Updated test decay functions.
  • Updated descriptions of decay functions and MiniSom class parameters.

These changes were previously discussed in #184

@BrandonGarciaWx BrandonGarciaWx marked this pull request as ready for review April 17, 2024 00:05
@JustGlowing
Copy link
Owner

hi @BrandonGarciaWx , thanks for raising this PR. I'll review it in the following days.

In the meanwhile, can you point out a reference to justify that the hypotenuse of the map is a good initial value for sigma?

minisom.py Outdated Show resolved Hide resolved
minisom.py Outdated Show resolved Hide resolved
@JustGlowing JustGlowing added enhancement to-be-merged PR that will be merged soon labels Apr 17, 2024
@BrandonGarciaWx
Copy link
Contributor Author

BrandonGarciaWx commented Apr 18, 2024

Thank you for the comments, I believe I have addressed them all. I also made some additional minor changes to some decay function descriptions and names.

My justification for the hypotenuse of the SOM being a good initial value for sigma comes from the following paper:
Gervais_etal_2016.pdf. Specifically, the sentence on page 2361 that reads

It is good practice to begin the training with a radius of influence equal to the diameter of the SOM to ensure that all nodes are updated and decrease the value with training time (Kohonen 2001).

I know the lead author personally and confirmed that "diameter" and "hypotenuse" mean the same thing in this context.

The citation for Kohonen (2001) is

Kohonen, 2001: Self-Organizing Maps. 3rd ed. Springer Series in Information Sciences, Vol. 30, Springer, 502 pp.

minisom.py Outdated Show resolved Hide resolved
minisom.py Outdated Show resolved Hide resolved
@BrandonGarciaWx
Copy link
Contributor Author

In addition to removing the text about custom decay functions, I added a function for sigma to linearly decrease to one.

minisom.py Outdated Show resolved Hide resolved
@JustGlowing
Copy link
Owner

In addition to removing the text about custom decay functions, I added a function for sigma to linearly decrease to one.

See my comment here: https://github.com/JustGlowing/minisom/pull/185/files#r1572485322

minisom.py Outdated Show resolved Hide resolved
@BrandonGarciaWx
Copy link
Contributor Author

Decay functions have been moved and function descriptions have been updated.

@JustGlowing
Copy link
Owner

Thanks for your contribution @BrandonGarciaWx !

@JustGlowing JustGlowing merged commit 09d048c into JustGlowing:master Apr 24, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement to-be-merged PR that will be merged soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants