I am not sure why set the units = 3 in the first layer. Please see the code below. There are only total 2 features, duration and temperature. How can the neuron be as 3? Thank you for the help.
tf.random.set_seed(1234) # applied to achieve consistent results
model = Sequential(
[
tf.keras.Input(shape=(2,)),
Dense(3, activation=‘sigmoid’, name = ‘layer1’),
Dense(1, activation=‘sigmoid’, name = ‘layer2’)
]
)
The input layer is tf.keras.Input(shape=(2,)) shape is 2 is equal 2 features we have it is called input layer and after the input layer Dense(3 , …) is called layer 1 not the input layer and number of units is optional not related with the features we have …because an input layer is the only related layer to and input features
The number of features in the input data doesn’t impose any limit to the choice of number of units in any hidden layer. We pick a choice that gives us the best cv performance which you will learn more in course 2 week 3.