Tensorflow
Basic Dense Network Model
# Initiate the layers
l0 = tf.keras.layers.Dense(units=1, input_shape=[1])
# Assemble layers into the model
model = tf.keras.Sequential([l0])
# You can also do all this by defining the layers inside the model
model = tf.keras.Sequential([
tf.keras.layers.Dense(units=1, input_shape=[1])
])
# Compile the model
model.compile(loss='mean_squared_error',
optimizer=tf.keras.optimizers.Adam(0.1))
# Train the model using the fit method
history = model.fit(celsius_q, fahrenheit_a, epochs=500, verbose=False)
print("Finished training the model")
# Make a prediction
model.predict([100.0])Dense Layers


Last updated