Code Room
Vibe codingMedium
Question
An AI evaluated this demand-forecasting regression and reported a great R-squared. The forecasts are systematically off in production. Critique the metric choice.
import numpy as npfrom sklearn.metrics import r2_score preds = model.predict(X_test) # predicting daily units soldr2 = r2_score(y_test, preds)print(f'R2 = {r2:.3f}') # R2 = 0.91# pick the model with the highest R2best = max(candidates, key=lambda m: r2_score(y_test, m.predict(X_test)))What a strong answer looks like
Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.
Learn the concepts
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.
Run or narrate your approach, then ask the coach.