Skip to main content

Steps in Modeling

Summary

  • Creating a model (Define the structure)
  • Compiling a model (Create the model)
  • Fitting a model (Train)
  • Evaluate

Content

  1. Creating a model
model = tf.keras.Sequential([
tf.keras.layers.Input(1),
tf.keras.layers.Dense(1)
])
  1. Compiling a model
model.compile(
loss=tf.keras.losses.mae,
optimizer=tf.keras.optimizers.SGD(),
metrics=[ tf.keras.losses.mae ]
)
  1. Fitting a model
model.fit(X, y, epochs=5)
  1. Evaluate
model.predict([7])
# array([[-6.81166]], dtype=float32)
# it's incorrect but it's fine