Commit bcc49658 authored by lucas_miranda's avatar lucas_miranda
Browse files

Modified GMVAEP - GRUs instead of LSTMs, stricted clipping, less deep, l1...

Modified GMVAEP - GRUs instead of LSTMs, stricted clipping, less deep, l1 regularization in cluster means, uniform initializer of variances
parent 1ebd5f15
...@@ -15,7 +15,7 @@ import tensorflow_probability as tfp ...@@ -15,7 +15,7 @@ import tensorflow_probability as tfp
from tensorflow.keras import Input, Model, Sequential from tensorflow.keras import Input, Model, Sequential
from tensorflow.keras.activations import softplus from tensorflow.keras.activations import softplus
from tensorflow.keras.constraints import UnitNorm from tensorflow.keras.constraints import UnitNorm
from tensorflow.keras.initializers import he_uniform from tensorflow.keras.initializers import he_uniform, random_uniform
from tensorflow.keras.layers import BatchNormalization, Bidirectional from tensorflow.keras.layers import BatchNormalization, Bidirectional
from tensorflow.keras.layers import Dense, Dropout, GRU from tensorflow.keras.layers import Dense, Dropout, GRU
from tensorflow.keras.layers import RepeatVector, Reshape, TimeDistributed from tensorflow.keras.layers import RepeatVector, Reshape, TimeDistributed
...@@ -398,6 +398,7 @@ class GMVAE: ...@@ -398,6 +398,7 @@ class GMVAE:
// 2, // 2,
name="cluster_means", name="cluster_means",
activation=None, activation=None,
activity_regularizer=(tf.keras.regularizers.l1(10e-5)),
kernel_initializer=he_uniform(), kernel_initializer=he_uniform(),
)(encoder) )(encoder)
...@@ -411,6 +412,7 @@ class GMVAE: ...@@ -411,6 +412,7 @@ class GMVAE:
activity_regularizer=( activity_regularizer=(
tf.keras.regularizers.l2(0.01) if self.reg_cluster_variance else None tf.keras.regularizers.l2(0.01) if self.reg_cluster_variance else None
), ),
kernel_initializer=random_uniform(),
)(encoder) )(encoder)
z_gauss = tf.keras.layers.concatenate([z_gauss_mean, z_gauss_var], axis=1) z_gauss = tf.keras.layers.concatenate([z_gauss_mean, z_gauss_var], axis=1)
......
...@@ -422,16 +422,16 @@ def autoencoder_fitting( ...@@ -422,16 +422,16 @@ def autoencoder_fitting(
Xvals, yvals = X_val[:-1], [X_val[:-1], X_val[1:]] Xvals, yvals = X_val[:-1], [X_val[:-1], X_val[1:]]
if phenotype_prediction > 0.0: if phenotype_prediction > 0.0:
ys += [y_train[-Xs.shape[0]:, 0]] ys += [y_train[-Xs.shape[0] :, 0]]
yvals += [y_val[-Xvals.shape[0]:, 0]] yvals += [y_val[-Xvals.shape[0] :, 0]]
# Remove the used column (phenotype) from both y arrays # Remove the used column (phenotype) from both y arrays
y_train = y_train[:, 1:] y_train = y_train[:, 1:]
y_val = y_val[:, 1:] y_val = y_val[:, 1:]
if rule_based_prediction > 0.0: if rule_based_prediction > 0.0:
ys += [y_train[-Xs.shape[0]:]] ys += [y_train[-Xs.shape[0] :]]
yvals += [y_val[-Xvals.shape[0]:]] yvals += [y_val[-Xvals.shape[0] :]]
# Convert data to tf.data.Dataset objects # Convert data to tf.data.Dataset objects
train_dataset = ( train_dataset = (
...@@ -592,16 +592,16 @@ def tune_search( ...@@ -592,16 +592,16 @@ def tune_search(
Xvals, yvals = X_val[:-1], [X_val[:-1], X_val[1:]] Xvals, yvals = X_val[:-1], [X_val[:-1], X_val[1:]]
if phenotype_prediction > 0.0: if phenotype_prediction > 0.0:
ys += [y_train[-Xs.shape[0]:, 0]] ys += [y_train[-Xs.shape[0] :, 0]]
yvals += [y_val[-Xvals.shape[0]:, 0]] yvals += [y_val[-Xvals.shape[0] :, 0]]
# Remove the used column (phenotype) from both y arrays # Remove the used column (phenotype) from both y arrays
y_train = y_train[:, 1:] y_train = y_train[:, 1:]
y_val = y_val[:, 1:] y_val = y_val[:, 1:]
if rule_based_prediction > 0.0: if rule_based_prediction > 0.0:
ys += [y_train[-Xs.shape[0]:]] ys += [y_train[-Xs.shape[0] :]]
yvals += [y_val[-Xvals.shape[0]:]] yvals += [y_val[-Xvals.shape[0] :]]
tuner.search( tuner.search(
Xs, Xs,
......
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