Like a script with two acts. In each act: your idea → your prompt → the agent's TUI → the figure → your judgment: is this what I wanted?
Act 1 · The idea → the plan
idea: the spectral lines depend on the train speed (f ≈ v/d) — can a single station measure the speed? But hand-writing that logic is too complicated... let's use machine learning.
The spectral lines relate to the train speed. Can a single station measure the speed? Hand-written logic is too complicated — use machine learning. Make me a plan.
> The spectral lines relate to the train speed. Can a single station measure the speed? Hand-written logic is too complicated — use machine learning. Make me a plan.
▌
✦ Agent · plan mode —
1. Load hsr_waveform_velocity.npz; use its fixed idx_train / idx_test.
2. Build a small 1D CNN (PyTorch): waveform → speed, ~300k params.
3. Train 15 epochs, Adam, MSE, fixed seed.
4. Evaluate: MAE, RMSE, R² on the held-out test set.
5. Plot predicted vs true speed + error histogram + loss curve.
→ Answer: if the test MAE is far below the 4.55 m/s baseline,
one station is enough.
Is this the plan you wanted? Anything to change before it starts? Ask your AI — e.g. "train longer", "also show the loss curve".
Act 2 · Execute → the result
next line: the plan looks good. Execute it — I want to see the fitting result.
OK. Execute the plan — I want to see the fitting result.
OK. Execute the plan — I want to see the fitting result.
> OK. Execute the plan — I want to see the fitting result.
▌
✦ Agent · build mode —
$ python train.py
epoch 5/15 train MSE 0.041 val MSE 0.050
epoch 10/15 train MSE 0.025 val MSE 0.035
epoch 15/15 train MSE 0.016 val MSE 0.030
test MAE = 0.59 m/s (2.1 km/h)
test RMSE = 1.11 m/s
test R2 = 0.971
baseline = 4.55 m/s → 7.7× better than "guess the mean"
The agent's verification figure: loss curves (left), predicted vs true speed (middle), error histogram (right).
Is this the result you wanted? Read the figure: the scatter hugs the 1:1 line (r ≈ 0.99), the errors are small and centered, the loss converged. The fit is good — one station CAN measure the speed, to within ~2 km/h.
The answer: the network found the line/Doppler mapping all by itself — no hand-written f ≈ v/d logic needed. One station, 25 s of waveform → speed to ~2 km/h. 320 stations are for imaging and location; for speed alone, one is enough.
Act 3 · Iteration
idea: the fit is not so good. Try more epochs — can it fit better?
Not so good. Try more epochs — can it fit better?
Not so good. Try more epochs — can it fit better?
> Not so good. Try more epochs — can it fit better?
▌
✦ Agent · build mode —
$ python train.py --epochs 30
epoch 10/30 train MSE 0.025 val MSE 0.035
epoch 20/30 train MSE 0.018 val MSE 0.031
epoch 30/30 train MSE 0.014 val MSE 0.031
test MAE = 0.62 m/s (2.2 km/h)
test RMSE = 1.12 m/s
test R2 = 0.971
→ barely changed vs 15 epochs (MAE 0.59): the loss already
converged. More training does NOT help — the remaining error
comes from the data itself, not from underfitting.
30 epochs: essentially the same fit as 15 epochs.
Is this the result you wanted? The agent should tell you honestly: more epochs did not make it better. Why? The loss converged at ~15 epochs — the limit is the data (noise, label accuracy), not the training time. A good agent says so instead of just agreeing with you.
That's the full loop: idea → plan → execute → judge → iterate. You and the agent just did in 30 minutes what a research pipeline takes days to set up — and you learned that the network's ceiling is set by the data, not by its appetite for training.
Think · Why not 100%?
The fit reached R² ≈ 0.97 — not 1.00. Three suspects:
- Data: is the waveform simply unable to support a more precise speed — noise, resonance, multiple wave paths?
- Labels: is the "true" speed itself slightly wrong? (The labels came from 320 stations — how exact is that measurement, really?)
- Network: is the model still too small or wrongly shaped to extract everything available?
Now run your own loop
Pick one suspect, design an experiment to test it, and let your agent run it. Judge the result, iterate — the loop you've been practicing all lab. Get started, e.g. ask your AI: "how accurate are the speed labels?", "what is the label noise floor?", "what happens if we predict the average speed of nearby events instead of the waveform?"
There is no single right answer — the point is that you now know how to find out.