All examples
Neural networks

Native neural training with one explicit context

Fit a protected Iris partition with the same model and configuration on a strict CPU, CUDA or Metal/MPS context.

Download .aner source
neural_local.aner
// Iris: Fisher (1936), UCI, CC BY 4.0. See THIRD_PARTY_DATA.md.
// Strict CPU Float64; training, validation and test retain protected roles.
import aner.dataset
import aner.nn
import aner.ml
import aner.parallel
import aner.dev

let parts = dataset.iris().partition(validation: 0.2, test: 0.2, seed: 42)
print(parts.audit())
let model = ml.classifier(
    nn.mlp(inputs: 4, hidden: List(8), outputs: 3, seed: 42),
    standardize: true, loss: "cross_entropy", optimizer: "adam")
let config = ml.training(epochs: 40, batch: 32, rate: 0.01, seed: 42)
    .validation(parts.validation())
let execution = parallel.device(device: "cpu", dtype: "Float64")
let fitted = parallel.fit(model: model, data: parts.train(),
    config: config, execution: execution, progress: true)
dev.capture("Canonical fitted classifier", fitted)
print(fitted.summary())
print(fitted.evaluate(parts.test()).summary())

Make it your experiment.

With Aner installed, save this program as examples/parallel/neural_local.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/parallel/neural_local.aner
aner run examples/parallel/neural_local.aner

The aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.

Use the compatible native Aner development engine and VS Code extension 0.1.33. The local programs require no remote configuration. Strict CPU/CUDA supports Float64 and Float32; Metal/MPS requires Float32. Configured groups require private enrollment accessible only to its owner and installed workers with compatible source. See Distributed neural training for placement, protected roles, weighted gradients and Dev observation limits.

Iris and Wine are teaching datasets with their own attribution. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner