// Requires the matching 0.0.10-dev.3 development runtime.
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: CentroidModel = ml.fit_emeans(features: x, clusters: 2,
    epochs: 3.0, seed: 42, execution: execution)
print(model.summary())
print(model.inertia())
let predicted = model.predict(input: [[0.0, 1.0], [10.0, 11.0]],
    execution: execution)
print(tensor.value(predicted, 0, 0))
print(tensor.value(predicted, 1, 0))
// IDs are arbitrary center indices. Inspect coordinates to interpret them.
let centers = model.centers()
print(tensor.value(centers, 0, 0))
print(tensor.value(centers, 1, 0))
