Project 8: Binary Classifier Compiler
ML Engineer
Builds on these lessons
Current Task
Objective
.compile() attaches an optimizer and a loss function to a model — required before it can be trained with .fit().
Task: build a Sequential model for binary classification, compile it, and print how many layers it has.
index.py
import tensorflow as tf
from tensorflow.keras import layers, Sequential
model = Sequential([
layers.Dense(16, activation='relu', input_shape=(10,)),
layers.Dense(1, activation='sigmoid')
])
model.compile(optimizer='adam', loss='binary_crossentropy')
print(len(model.layers))
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview