All examplesNeural networks Install Aner
An Iris classifier in a few lines
Split first, fit preprocessing on training rows, and evaluate a small dense classifier on held out data.
Download .aner source// Iris: Fisher (1936), UCI, CC BY 4.0. See THIRD_PARTY_DATA.md.
// Split first; the fitted pipeline learns preprocessing only from training rows.
import aner.dataset
import aner.nn
import aner.ml
let flowers = dataset.iris()
let split = flowers.split(test: 0.2, seed: 2026)
let network = nn.sequential(seed: 42)
.dense(inputs: 4, outputs: 8)
.tanh()
.dense(inputs: 8, outputs: 3)
let pipeline = ml.classifier(network, standardize: true)
let fitted = pipeline.fit(split.train(), epochs: 2000, rate: 0.1)
print(fitted.evaluate(split.test()).summary())
Make it your experiment.
With Aner installed, save this program as examples/neural_iris_concise.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/neural_iris_concise.aner
aner run examples/neural_iris_concise.anerThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
Iris and Wine are teaching datasets with their own attribution. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution