Skip to content

Instantly share code, notes, and snippets.

@a-agmon
Last active June 29, 2020 20:58
Show Gist options
  • Save a-agmon/f53feb4c81ae6ce223219245d7c8a0d3 to your computer and use it in GitHub Desktop.
Save a-agmon/f53feb4c81ae6ce223219245d7c8a0d3 to your computer and use it in GitHub Desktop.
#Create the train and test set
TRAIN_RATIO = 0.75
train_size = int(len(vec_seqs) * TRAIN_RATIO)
X_train = vec_seqs[:train_size]
X_test = vec_seqs[train_size:]
#define the encoder
input_dim = X_train.shape[1] #features num
encoding_dim = 32 #hidden layer size
nb_epoch = 3
batch_size = 128
learning_rate = 1e-2
input_layer = Input(shape=(input_dim,))
encoder = Dense(encoding_dim, activation="relu", activity_regularizer=regularizers.l1(learning_rate))(input_layer)
decoder = Dense(input_dim, activation="relu")(encoder)
autoencoder = Model(inputs=input_layer, outputs=decoder)
autoencoder.summary()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment