Evaluate a chronological sequence workflow
Split before windowing, fit a native recurrent model and inspect detached held out metrics and optimizer phases.
// Split chronological segments before windowing. These scaled synthetic
// values need no fitted transform; fit real scaling only on training data.
import aner.nn
let train_series: Tensor = [
[-0.9], [-0.8], [-0.7], [-0.6], [-0.5],
[-0.4], [-0.3], [-0.2], [-0.1], [0.0]]
let valid_series: Tensor = [[0.1], [0.2], [0.3], [0.4], [0.5], [0.6]]
let x = nn.sequence_windows(train_series, window: 3)
let y = nn.sequence_targets(train_series, window: 3)
let valid_x = nn.sequence_windows(valid_series, window: 3)
let valid_y = nn.sequence_targets(valid_series, window: 3)
let model = nn.lstm(inputs: 1, hidden: 8, seed: 17).on("cpu", "Float64")
let fitted = model.fit(x, y, epochs: 12, batch: 4,
rate: 0.01, clip_norm: 1.0)
let validation = fitted.evaluate(valid_x, valid_y, batch: 2)
print(validation.summary())
print(validation.samples())
print(validation.observations())
print(fitted.diagram())
// train_step keeps optimizer moments across independent loader minibatches;
// fit_chunk instead carries detached memory through ordered streaming chunks.
// fitted.save("sequence-workflow.anerrnn")
Make it your experiment.
Use the matching runtime. Save this program as examples/recurrent_workflow.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/recurrent_workflow.aner
aner run examples/recurrent_workflow.anerThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
Requires the matching Aner 0.0.7-dev.1 runtime and editor. Uses complete synthetic tensors without dataset downloads, credentials or network connections. These source additions are separate from published packages. Optional accelerators and collectives require a compatible build and hardware; CPU checks do not establish GPU or distributed performance.
aner check examples/recurrent_workflow.aner
aner run examples/recurrent_workflow.anerBundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution