All examplesNeural networks Install Aner
Mini batch Adam with explicit validation
Train a small Iris network on protected roles, select a validation snapshot and evaluate only after fitting.
// Offline audited Dense classification with training, validation and final test roles.
import aner.dataset
import aner.nn
import aner.ml
let parts = dataset.iris().partition(validation: 0.2, test: 0.2, seed: 42)
let training = parts.train()
let validation = parts.validation()
let testing = parts.test()
print(training.rows())
print(validation.rows())
print(testing.rows())
let network = nn.mlp(inputs: 4, hidden: List(16, 8), outputs: 3, seed: 42)
let config = ml.training(epochs: 100, batch: 16, rate: 0.01, seed: 42)
.validation(validation).select_best(true)
let plan = ml.classifier(network, standardize: true, optimizer: "adam")
let fitted = plan.fit(training, config: config)
let report = fitted.evaluate(testing)
print(fitted.training_loss() < fitted.initial_loss())
print(report.accuracy() >= 0.0 && report.accuracy() <= 1.0)
Make it your experiment.
With Aner installed, save this program as examples/neural_minibatch.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/neural_minibatch.aner
aner run examples/neural_minibatch.anerThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
Use a compatible current native Aner executable. This complete example runs locally with the declared inputs; the guide explains exact shapes, expected results and resource limits.
Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution