I am building a ANN model. When I run the following code, it shows as “TypeError: ‘property’ object is not iterable”. Am I not able to understand how to fix this.
The code:
model=Sequential()
model.add(Dense(512, activation=tf.nn.relu))
model.add(Dense(256, activation=tf.nn.tanh))
model.add(Dense(128, activation=tf.nn.relu))
model.add(Dense(7))
# # Fitting the model
# In[37]:
loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
accuracy=tf.keras.metrics.SparseCategoricalAccuracy
optimizer=tf.keras.optimizers.Adam()
model.compile(loss=loss, optimizer=optimizer, metrics=[accuracy])
history=model.fit(xtrain, ytrain, validation_data=(xval, yval), batch_size=64, epochs=100)
I tried to build the ANN model but it throws the error.