Code Room
Vibe codingMediumvc-g260
Subject Ai code reviewLevel Mid–Senior~16 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

An AI produced this data-cleaning step before training. It runs without error and the model trains, but the loss curve is oddly noisy. Find the silent NaN bug.

python
import numpy as np # 'sensor' has missing readings encoded as -999df['sensor'] = df['sensor'].replace(-999, np.nan)df['sensor_norm'] = (df['sensor'] - df['sensor'].mean()) / df['sensor'].std()features = df[['sensor_norm', 'temp', 'pressure']].values.astype(np.float32)labels = df['target'].valuesmodel.fit(features, labels)   # no error raised
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.

Describe your solution

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.