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

It seems the next run will be influenced by the former run. Will it be more rational to reset after every run? #167

Closed
944750720 opened this issue Jun 16, 2023 · 4 comments

Comments

@944750720
Copy link

944750720 commented Jun 16, 2023

I found that if I run the minisom for twice with 10 epochs every time, it's different from running it for once (after rebooting the jupyter notebook). And it's more similar to run it for once with 20 epochs(after rebooting the jupyter notebook). I'm reading the train function now but I'm still not sure about the reason. The starting_weighs are reset ever time but the result still be affected by the former run.
Here is my code.

pixels = amp_phase_16_column

#SOM initialization and training
print('training...')
som = minisom.MiniSom(4, 4, 16, sigma=1.,
              learning_rate=0.9, neighborhood_function='bubble')  
som.random_weights_init(pixels)
starting_weights = som.get_weights().copy()  # saving the starting weights
som.train(pixels, 200, random_order=True, verbose=True, use_epochs=True)

print('quantization...')
qnt = som.quantization(pixels)  # quantize each pixels of the image
print('building new image...')
clustered = np.zeros((*amp_data.shape, 16), dtype=np.float64)

Finally I draw clustered pixel in 'clustered' by heatmap.

@JustGlowing
Copy link
Owner

Hi there, not sure I get your question but if you want to be able to replicate your experiments, you need to set random seed to a specific value. The MiniSom constructor takes in it input as random_seed.

@944750720
Copy link
Author

I set random_seed=None. I mean if I run minisom for 5 times (10 epochs every time), it should have output 5 similar results separately, but it actually output 5 results that seems like with accumulative weights. And the fifth result is more similar to the result run for 50 epochs.

@JustGlowing
Copy link
Owner

What do you mean by accumulative weights? Have you checked the quantization error?

@944750720 944750720 reopened this Jun 16, 2023
@944750720
Copy link
Author

Sorry, I found it's not the issue of minisom, and it seems I should write the topology code
more suitable for my data.

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

No branches or pull requests

2 participants