0cfe82c6beb9a28a5ff7da81b86fa0e93c388f14,tasks/save_reload_model.py,,,#,10

Before Change


x = Dropout(0.5)(x)  // and dropout here.
x = Dense(1, activation="sigmoid")(x)

model = Model(inputs=[i], outputs=[x])

if os.path.exists("tcn.npz"):
    // Load checkpoint if file exists.

After Change


max_features = 50

// make model
model = Sequential(layers=[Embedding(max_features, 16, input_shape=(max_len,)),
                           TCN(nb_filters=12,
                               dropout_rate=0.5,
                               kernel_size=6,
                               dilations=[1, 2, 4]),
                           Dropout(0.5),
                           Dense(units=1, activation="sigmoid")])

// get model as json string and save to file
model_as_json = model.to_json()
with open(r"model.json", "w") as json_file:
    json_file.write(model_as_json)
// save weights to file (for this format, need h5py installed)
model.save_weights("weights.h5")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: philipperemy/keras-tcn
Commit Name: 0cfe82c6beb9a28a5ff7da81b86fa0e93c388f14
Time: 2019-11-20
Author: premy@cogent.co.jp
File Name: tasks/save_reload_model.py
Class Name:
Method Name:


Project Name: altosaar/variational-autoencoder
Commit Name: b43325e297498269be86b281a02e2ef79664f273
Time: 2019-09-18
Author: altosaar@users.noreply.github.com
File Name: train_variational_autoencoder_tensorflow.py
Class Name:
Method Name: generative_network


Project Name: altosaar/variational-autoencoder
Commit Name: b43325e297498269be86b281a02e2ef79664f273
Time: 2019-09-18
Author: altosaar@users.noreply.github.com
File Name: train_variational_autoencoder_tensorflow.py
Class Name:
Method Name: inference_network