Project 26: Price Prediction Model
ML Engineer
Builds on these lessons
Current Task
Objective
Final project: build, compile, train, and predict — the complete deep learning workflow, applied to a tiny price-prediction example.
Task: train a one-layer model to predict the next day's price, then predict on a new value and print the output shape.
index.py
import tensorflow as tf
from tensorflow.keras import layers, Sequential
import numpy as np
prices = np.array([100.0, 105.0, 110.0, 115.0, 120.0])
next_day = np.array([105.0, 110.0, 115.0, 120.0, 125.0])
model = Sequential([layers.Dense(1, input_shape=(1,))])
model.compile(optimizer='adam', loss='mse')
model.fit(prices, next_day, epochs=10, verbose=0)
prediction = model.predict(np.array([125.0]), verbose=0)
print(prediction.shape)
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview