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
from tensorflow.keras import Input, Model, Sequential
from tensorflow.keras.activations import softplus
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 Dense, Dropout, GRU
from tensorflow.keras.layers import RepeatVector, Reshape, TimeDistributed
......@@ -398,6 +398,7 @@ class GMVAE:
// 2,
name="cluster_means",
activation=None,
activity_regularizer=(tf.keras.regularizers.l1(10e-5)),
kernel_initializer=he_uniform(),
)(encoder)
......@@ -411,6 +412,7 @@ class GMVAE:
activity_regularizer=(
tf.keras.regularizers.l2(0.01) if self.reg_cluster_variance else None
),
kernel_initializer=random_uniform(),
)(encoder)
z_gauss = tf.keras.layers.concatenate([z_gauss_mean, z_gauss_var], axis=1)
......
......@@ -422,16 +422,16 @@ def autoencoder_fitting(
Xvals, yvals = X_val[:-1], [X_val[:-1], X_val[1:]]
if phenotype_prediction > 0.0:
ys += [y_train[-Xs.shape[0]:, 0]]
yvals += [y_val[-Xvals.shape[0]:, 0]]
ys += [y_train[-Xs.shape[0] :, 0]]
yvals += [y_val[-Xvals.shape[0] :, 0]]
# Remove the used column (phenotype) from both y arrays
y_train = y_train[:, 1:]
y_val = y_val[:, 1:]
if rule_based_prediction > 0.0:
ys += [y_train[-Xs.shape[0]:]]
yvals += [y_val[-Xvals.shape[0]:]]
ys += [y_train[-Xs.shape[0] :]]
yvals += [y_val[-Xvals.shape[0] :]]
# Convert data to tf.data.Dataset objects
train_dataset = (
......@@ -592,16 +592,16 @@ def tune_search(
Xvals, yvals = X_val[:-1], [X_val[:-1], X_val[1:]]
if phenotype_prediction > 0.0:
ys += [y_train[-Xs.shape[0]:, 0]]
yvals += [y_val[-Xvals.shape[0]:, 0]]
ys += [y_train[-Xs.shape[0] :, 0]]
yvals += [y_val[-Xvals.shape[0] :, 0]]
# Remove the used column (phenotype) from both y arrays
y_train = y_train[:, 1:]
y_val = y_val[:, 1:]
if rule_based_prediction > 0.0:
ys += [y_train[-Xs.shape[0]:]]
yvals += [y_val[-Xvals.shape[0]:]]
ys += [y_train[-Xs.shape[0] :]]
yvals += [y_val[-Xvals.shape[0] :]]
tuner.search(
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