All examplesMachine learning Install Aner
Explore native o-means clustering
Run two level centroid search and inspect resolved coarse cells, probes and final predictions.
// Small teaching input; index overhead can exceed assignment savings here.
import aner.ml
import aner.tensor
import aner.parallel
let x = [[0.0, 0.0], [0.0, 2.0], [10.0, 10.0], [10.0, 12.0]]
let execution = parallel.local(workers: 2)
let model = ml.fit_omeans(features: x, clusters: 2,
epochs: 3.0, seed: 42, execution: execution)
print(model.summary())
print(model.coarse_cells())
print(model.probes())
print(model.inertia())
// Final prediction is exhaustive even when training searches fewer cells.
let predicted = model.predict(input: x, execution: execution)
print(tensor.value(predicted, 0, 0) == tensor.value(model.labels(), 0, 0))
Make it your experiment.
Use Aner 0.1.0 or newer. Save this program as examples/omeans_native.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/omeans_native.aner
aner run examples/omeans_native.anerThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
Requires Aner 0.1.0 or newer. Complete synthetic tensors are included; no download, credentials, external service or output file is needed. Uses CPU Float64 and a bounded local worker context.
aner check examples/omeans_native.aner
aner run examples/omeans_native.anerBundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution