Hyperparameters exploration via SOMs vectorization
In Self-Organizing Maps, hyperparameters like the neighborhood size or the learning rate are not easy to fine tune. It is often a process of trials and errors that need multiple iterations. To facilitate this exploration, somap
SOMs can be vectorized along multiple axis to test in parallel the combination of different hyperparameters.
Here is an example testing the combination of multiple sigma
and alpha
values for a simple static Kohonen SOM:
# Vectorize over the two hyperparamters of StaticKsom
@eqx.filter_vmap(in_axes=(None, 0))
@eqx.filter_vmap(in_axes=(0, None))
def myArrayOfStaticKsom(sigma, alpha):
return smp.StaticKsom(
shape=(10, 10),
topography="square",
borderless=True,
input_shape=(28, 28),
params=smp.StaticKsomParams(sigma=sigma, alpha=alpha),
)
# List of hyperparameters to test
sigmas = jnp.linspace(0.05, 0.2, 4)
alphas = jnp.linspace(0.001, 0.05, 3)
model = myArrayOfStaticKsom(sigmas, alphas)
model