Created
August 7, 2021 19:34
-
-
Save detrin/a364f85741e22a42dc9b343aee5bd47f to your computer and use it in GitHub Desktop.
Serve ML model with Flask REST API - 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
normalizer = preprocessing.Normalization(axis=-1) | |
normalizer.adapt(np.array(train_features)) | |
model = keras.Sequential( | |
[ | |
normalizer, | |
layers.Dense(64, activation="relu"), | |
layers.Dense(64, activation="relu"), | |
layers.Dense(1), | |
] | |
) | |
model.compile(loss="mean_absolute_error", optimizer=tf.keras.optimizers.Adam(0.001)) | |
train_features, test_features, train_labels, test_labels = get_data() | |
model = get_model(train_features) | |
model.summary() | |
history = model.fit( | |
train_features, train_labels, validation_split=0.2, verbose=2, epochs=100 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment