Commit 5ea727d0 authored by lucas_miranda's avatar lucas_miranda
Browse files

Minimise entropy to see if overal confidence increases in a reproducible way

parent 3dbb5a62
......@@ -355,7 +355,7 @@ class Entropy_regulariser(Layer):
# axis=1 increases the entropy of a cluster across instances
# axis=0 increases the entropy of the assignment for a given instance
entropy = -K.sum(tf.multiply(z + 1e-5, tf.math.log(z) + 1e-5), axis=1)
entropy = K.sum(tf.multiply(z + 1e-5, tf.math.log(z) + 1e-5), axis=1)
# Adds metric that monitors dead neurons in the latent space
self.add_metric(entropy, aggregation="mean", name="-weight_entropy")
......
......@@ -171,7 +171,7 @@ class SEQ_2_SEQ_GMVAE:
number_of_components=1,
predictor=True,
overlap_loss=False,
entropy_reg_weight=0.05,
entropy_reg_weight=0.0,
):
self.input_shape = input_shape
self.batch_size = batch_size
......@@ -315,9 +315,11 @@ class SEQ_2_SEQ_GMVAE:
encoder = BatchNormalization()(encoder)
encoding_shuffle = MCDropout(self.DROPOUT_RATE)(encoder)
z_cat = Dense(self.number_of_components, activation="softmax",)(
encoding_shuffle
)
z_cat = Dense(
self.number_of_components,
activation="softmax",
activity_regularizer=tf.keras.regularizers.l1(),
)(encoding_shuffle)
z_cat = Entropy_regulariser(self.entropy_reg_weight)(z_cat)
z_gauss = Dense(
tfpl.IndependentNormal.params_size(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment