Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to compile the model with the Adam optimizer.
TensorFlow
model.compile(optimizer=[1], loss='sparse_categorical_crossentropy', metrics=['accuracy'])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using an optimizer name that is not supported or misspelled.
Passing an optimizer object instead of a string.
✗ Incorrect
The Adam optimizer is specified as the string 'adam' in the compile method.
2fill in blank
mediumComplete the code to compile the model using Mean Squared Error as the loss function.
TensorFlow
model.compile(optimizer='adam', loss=[1], metrics=['mae'])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a classification loss for a regression problem.
Misspelling the loss function name.
✗ Incorrect
Mean Squared Error loss is specified as 'mean_squared_error' in TensorFlow.
3fill in blank
hardFix the error in the code by selecting the correct metric name.
TensorFlow
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=[[1]])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using deprecated metric names like 'acc'.
Misspelling metric names causing runtime errors.
✗ Incorrect
The correct metric name is 'accuracy'. 'acc' is deprecated and misspelled options cause errors.
4fill in blank
hardFill both blanks to compile the model with RMSprop optimizer and binary crossentropy loss.
TensorFlow
model.compile(optimizer=[1], loss=[2], metrics=['accuracy'])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing optimizer and loss function names.
Using categorical loss for binary classification.
✗ Incorrect
RMSprop optimizer is 'rmsprop' and binary crossentropy loss is 'binary_crossentropy'.
5fill in blank
hardFill all three blanks to compile the model with SGD optimizer, hinge loss, and precision metric.
TensorFlow
model.compile(optimizer=[1], loss=[2], metrics=[[3]])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong optimizer or loss names.
Confusing precision with other metrics.
✗ Incorrect
SGD optimizer is 'sgd', hinge loss is 'hinge', and precision metric is 'precision'.