Simple MLP training example (regression) #
This is a focused end-to-end example of training a small MLP in TorchLean.
It mirrors the simplest PyTorch workflow:
- build a small synthetic dataset (in-memory),
- define an MLP (
Linear -> ReLU -> Linear), - train with Adam,
- report loss before/after, plus a few sample predictions.
Run:
lake exe torchlean quickstart_mlplake exe torchlean quickstart_mlp --steps 200 --dtype float --backend eager
Optional flags (tutorial-specific):
--seed S(model init + any shuffling)--steps N
Default JSON log path used only when the user explicitly passes --log.
Instances For
Small piecewise-linear regression target:
y = 0.8 * relu(x1 + x2) - 0.4 * relu(x2 - x1) + 0.2.
This is a natural fit for a small ReLU MLP, which keeps the command dependable.
Instances For
Build the tutorial dataset at the runtime-selected scalar type.
Data.regression2to1Grid keeps shape-indexed tensor slicing out of the first training example.
The underlying value is still a TorchLean supervised dataset with checked input/output shapes.
Instances For
Command-line help for the simple MLP quickstart.