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

Add norm-p as distance metric (with positive real p) #160

Closed tomcucinotta closed 3 years ago

tomcucinotta commented 3 years ago

This patch adds the option to provide as vect_distance strings like "norm-3", "norm-6", "norm-2" (same as the default) and "norm-inf", besides "euclidean" when creating the SOM (norm-p with any positive real p). For example:

som = somoclu.Somoclu(n_columns, n_rows, compactsupport=False, vect_distance="norm-6")

This is supported with kerneltype = 0 only, at the moment (the GPU kernel uses an optimized implementation tied to p=2, but in the future it might be possible to add in denseGpuKernels.cu, alongside the current implementation, an alternate one if norm-p is specified).

xgdgsc commented 3 years ago

Thamks!