[BUGFIX] Neural Gas gets prototype intiailizer from kwargs

This commit is contained in:
Alexander Engelsberger 2021-06-03 15:24:17 +02:00
parent 358f27257d
commit 0bc385fe7b

View File

@ -191,12 +191,10 @@ class NeuralGas(AbstractPrototypeModel):
self.hparams.setdefault("input_dim", 2) self.hparams.setdefault("input_dim", 2)
self.hparams.setdefault("agelimit", 10) self.hparams.setdefault("agelimit", 10)
self.hparams.setdefault("lm", 1) self.hparams.setdefault("lm", 1)
self.hparams.setdefault("prototype_initializer",
ZerosInitializer(self.hparams.input_dim))
self.proto_layer = Components( self.proto_layer = Components(
self.hparams.num_prototypes, self.hparams.num_prototypes,
initializer=self.hparams.prototype_initializer) initializer=kwargs.get("prototype_initializer"))
self.distance_layer = LambdaLayer(euclidean_distance) self.distance_layer = LambdaLayer(euclidean_distance)
self.energy_layer = NeuralGasEnergy(lm=self.hparams.lm) self.energy_layer = NeuralGasEnergy(lm=self.hparams.lm)