peterwittek / somoclu

Massively parallel self-organizing maps: accelerate training on multicore CPUs, GPUs, and clusters
https://peterwittek.github.io/somoclu/
MIT License
268 stars 70 forks source link

Can I set the random seed? #163

Closed yanzastro closed 2 years ago

yanzastro commented 2 years ago

Can we set the random seeds to initialize the SOM?

xgdgsc commented 2 years ago

https://github.com/peterwittek/somoclu/blob/4e467051cf1b291c498c5e3972e597ce4f57bfab/src/training.cpp#L272 in Cpp, in R like https://github.com/peterwittek/somoclu/issues/51

yanzastro commented 2 years ago

thanks! is it possible to set it from python?

xgdgsc commented 2 years ago

generate the initialcodebook by your seed and pass to the constructor?

yanzastro commented 2 years ago

sounds like a great idea! So I just run something like:

codebook_ini = init(data, seed)  # init() is a pre-defined function to initialize the codebook
som.codebook = codebook_ini
som.train(...)

is it correct?

---edit---

Oh I see there is a initialcodebook parameter. never mind!