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

Do you know why nodes change completely when I reran the same setup with varying number of iterations? #146

Closed
michel039 opened this issue Jul 8, 2022 · 12 comments
Labels

Comments

@michel039
Copy link

michel039 commented Jul 8, 2022

Hey :-)

First of all thank you for providing this tool, it seems very handy! I am using SOM with geopotential height anomalies over a given region as input variables to cluster meteorological circulation patterns (ca. 2000 observations). What is really strange is that the SOM nodes differ completely when I rerun the same setup with more iterations (e.g. doubling from 10000 to 20000). It produces nodes not only in a different order, but also such that have no analogue in the new SOM... Is there anything I am doing wrong?

Thank you very much - below some details about the setup

The example I am using most often is sigma=1 (Gaussian), lr=0.5, SOM sizes between 2x4 to 4x5. The problem occurs no matter the initialization (pca or random) and no matter the training (single, batch, random). My code is basically only:

SOM

som = MiniSom(som_m, som_n, ndims, sigma=sigma, learning_rate=lr, neighborhood_function='gaussian')
som.pca_weights_init(somarr)
som.train_batch(somarr,10000,verbose=True)

...

plot

for m in range(som_m):
for n in range(som_n):
ax...
pltarr = som.get_weights()[m,n,:].reshape((nsomlat,nsomlon))
p = ax.contourf(somlons,somlats,pltarr,cmap='seismic', transform=ccrs.PlateCarree())

@michel039 michel039 changed the title Do you know why nodes change completely when I reran the same setup? Do you know why nodes change completely when I reran the same setup with varying number of iterations? Jul 8, 2022
@JustGlowing
Copy link
Owner

JustGlowing commented Jul 9, 2022 via email

@michel039
Copy link
Author

Thanks. Is this the case even though I initialize with pca weights? And is it also normal that it does not reproduce at least the same patterns?

@JustGlowing
Copy link
Owner

PCA weights should always be the same. You can check the weights like this som.get_weights()

@michel039
Copy link
Author

Ok, so would changing results be an indication of one of the rare cases where more iterations lead to different results, i.e., there is no convergence?

@JustGlowing
Copy link
Owner

To be precise, PCA weights are always the same when initialized with the same data. Training is supposed to converge as long as the learning rate decreases.

@michel039
Copy link
Author

Yes, after initialization the weights are the same for both setups. So could the results change due to the increase in iterations and the thereby altered decay function? Cause they are quite substantially different

@JustGlowing
Copy link
Owner

it should not happen in theory. Have you tried checking the quantization error throughout the iterations? The example at the bottom of this notebook shows how to do it https://github.com/JustGlowing/minisom/blob/master/examples/BasicUsage.ipynb

@michel039
Copy link
Author

Ok, thanks! Topographic error is increasing with iterations. Quantization error is very large, but I think this is due to the large values (I am using anomalies that are not normalized). Do you have an idea why topographic error can increase?

Screenshot_20220711_094756

@JustGlowing
Copy link
Owner

@michel039
Copy link
Author

Thanks, unfortunately doesn't change much. I will try for different som sizes, but not sure if this will help too much..

image

@michel039
Copy link
Author

I now use the som toolbox on Matlab (I know...) which performs well, i.e., produces similar results for increasing number of iterations. Let me know if you want to know more about my problem if that's of any relevance to your python module

@JustGlowing
Copy link
Owner

if you properly set learning rate and decay function, you will get consistent results after a certain number of iterations. I can't give advice regarding the matlab toolbox.

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

2 participants