All examples
Machine learning

Run a building energy prediction asynchronously

Fit the energy model while a proposal is pending, then save the proposed observation for review.

agent_energy_async.aner
// Run at the project root with the energy fixture and a local Ollama model.
// Use a fresh directory name for each separate approval.
import aner.agent
import aner.llm
import aner.data
import aner.ml
import aner.tensor

let local = llm.client(provider: "ollama", model: "qwen2.5:14b-instruct", endpoint: "http://127.0.0.1:11434")
let pending = llm.prediction_turn_async(local, "Predict energy for validation observation 401.")

// The native model can be fitted while the provider prepares its proposal.
let schema = data.schema()
    .column("row_id", "Int64", false)
    .column("building_id", "String", false)
    .column("temperature", "Float64", false)
    .column("occupancy", "Float64", false)
    .column("energy", "Float64", false)
let table = data.scan_csv("examples/fixtures/contextual/energy.csv", schema, "NA").collect(16, 1048576, 4)
let frame = data.frame(table, "row_id", "building_id", "energy", List("", "", "degC", "1", "kWh"))
let split = frame.partition_groups(List("B0", "B1", "B2", "B3"), List("B4", "B5"), List("B6", "B7"))
let scaler = ml.fit_standardizer(split.train())
let fit = ml.fit_linear(scaler.transform(split.train()).batch(1048576))
let proposal = pending.wait()
let run = agent.start_run("energy-async-401.run", proposal, 401, fit, scaler, split.validation())
print(proposal.model())
print(proposal.text())
print(run.row_id())
print(run.state())

Make it your experiment.

Use Aner 0.1.2 or newer. Save this program as examples/agent_energy_async.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/agent_energy_async.aner
aner run examples/agent_energy_async.aner --prod

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

Use Aner 0.1.2 on macOS or Linux. Run Ollama locally with the model shown below and save the energy CSV at examples/fixtures/contextual/energy.csv beneath the project root. Use a fresh run directory for each independent approval.

Credential setup
ollama show qwen2.5:14b-instruct
aner run examples/agent_energy_async.aner --prod

Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner