LoslegenKostenlos loslegen

Hello nets!

You're going to build a simple neural network to get a feeling of how quickly it is to accomplish this in Keras.

You will build a network that takes two numbers as an input, passes them through a hidden layer of 10 neurons, and finally outputs a single non-constrained number.

A non-constrained output can be obtained by avoiding setting an activation function in the output layer. This is useful for problems like regression, when we want our output to be able to take any non-constrained value.

Diese Übung ist Teil des Kurses

Introduction to Deep Learning with Keras

Kurs anzeigen

Anleitung zur Übung

  • Import the Sequential model from tensorflow.keras.models and the Denselayer from tensorflow.keras.layers.
  • Create an instance of the Sequential model.
  • Add a 10-neuron hidden Dense layer with an input_shape of two neurons.
  • Add a final 1-neuron output layer and summarize your model with summary().

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Import the Sequential model and Dense layer
from tensorflow.keras.____ import ____
from tensorflow.keras.____ import ____

# Create a Sequential model
model = ____

# Add an input layer and a hidden layer with 10 neurons
model.add(Dense(____, input_shape=(____,), activation="relu"))

# Add a 1-neuron output layer
model.add(____)

# Summarise your model
model.____
Code bearbeiten und ausführen