Student starter code (30% baseline)
index.html- Main HTML pagescript.js- JavaScript logicstyles.css- Styling and layoutpackage.json- Dependenciessetup.sh- Setup scriptREADME.md- Instructions (below)💡 Download the ZIP, extract it, and follow the instructions below to get started!
By completing this project, you will:
Difficulty Level: Intermediate Estimated Time: 2-3 hours Prerequisites: Completed Activity 05 (Data Preparation) and Activity 06 (Regression)
v1-baseline-100percent.ipynb in Google Colab or Jupyterproject-01-instagram-reach.ipynb✅ Data Download & Loading
latin1)✅ Data Exploration (Phase 2)
✅ Data Preparation Setup
✅ Model Evaluation (Bonus)
| TODO | Task | Difficulty | Estimated Time |
|---|---|---|---|
| 1 | Scale the features using MinMaxScaler (fit + transform) | Medium | 8-10 min |
| 2 | Split data into train/test sets (33% test, random_state=42) | Medium | 5-7 min |
Success Criteria:
x_scaled values should be between 0 and 1x_train.shape should be (66, 5)x_test.shape should be (33, 5)| TODO | Task | Difficulty | Estimated Time |
|---|---|---|---|
| 3 | Create and train LinearRegression model | Medium | 7-10 min |
| 4 | Print model accuracy (score) and coefficients | Easy | 5 min |
| 5 | Make prediction for custom Instagram post data | Hard | 10-15 min |
Success Criteria:
You've successfully completed this project when:
from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler()
scaler.fit(x)
x_scaled = scaler.transform(x)
Why? Machine learning algorithms work better when features are on the same scale.
from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(
x_scaled, y, test_size=0.33, random_state=42
)
Why? We need separate data to train and evaluate our model fairly.
from sklearn.linear_model import LinearRegression
model = LinearRegression()
model.fit(x_train, y_train)
accuracy = model.score(x_test, y_test)
Why? Linear regression finds the best linear relationship between features and target.
Once you complete all TODOs, try these:
User Interface
input() promptsModel Evaluation Deep Dive
Experiment with Features
Visualize Results
.shape to verify data dimensionsprint() statements for debuggingSolution: Wrap prediction input in double brackets: [[282.0, 4.0, 9.0, 165.0, 54.0]]
Solution: Run the cell that creates the MinMaxScaler first
Solution: Verify you're using x_scaled (not x) in train_test_split
Solution: Check that you scaled the data BEFORE splitting, and used the correct target variable (y)
Solution: Make sure to scale the prediction input using scaler.transform() before model.predict()
x_train shape: (66, 5)
x_test shape: (33, 5)
y_train shape: (66,)
y_test shape: (33,)
Model Accuracy: 0.8461
Model coefficients: [115.67681478 1898.72802154 -394.46756815 -495.96781512 748.19781634]
Model intercept: 2358.9711885315516
For input [282.0, 4.0, 9.0, 165.0, 54.0]:
Predicted engagement: ~9300-9500
Ready to begin? Open project-01-instagram-reach.ipynb and start building your Instagram engagement predictor! 🚀