Project 27: Random Data Model Trainer
ML Engineer
Current Task
Objective
Review day: combine Sequential models and .fit() — days 8 and 11 — to train on random task-completion data.
Task: build, compile, and train a small model on random data for 3 epochs, printing how many loss values were recorded.
index.py
import tensorflow as tf
from tensorflow.keras import layers, Sequential
import numpy as np
model = Sequential([
layers.Dense(8, activation='relu', input_shape=(3,)),
layers.Dense(1)
])
model.compile(optimizer='adam', loss='mse')
x = np.random.rand(20, 3)
y = np.random.rand(20, 1)
history = model.fit(x, y, epochs=3, verbose=0)
print(len(history.history['loss']))
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview