JustGlowing / minisom

:red_circle: MiniSom is a minimalistic implementation of the Self Organizing Maps
MIT License
1.46k stars 426 forks source link

Quantization always uses Euclidean distance #192

Open ArlexMR opened 3 months ago

ArlexMR commented 3 months ago

Hi, thanks for this great SOM implementation.

I need to train a SOM using a custom distance function (specifically, Dynamic Time Warping from the tslearn package). However, I’ve noticed that within the self.quantization method, BMUs are computed using self._distance_from_weights, which uses Euclidean distance. Wouldn’t it be more consistent to compute BMUs using self._activation_distance instead since that is the distance metric used during training?

JustGlowing commented 2 months ago

hi @ArlexMR, this sounds like a good enhancement and I'll keep it in mind for future release.

ArlexMR commented 2 months ago

Great! I can create a pull request with that change if you find it helpful