Typed observations with preserved identity
Create a native immutable observation frame, split declared buildings and inspect training rows, roles, feature units and bounded model inputs.
// Synthetic building observations: keep group membership and observation identity.
// Run from the directory containing examples/fixtures/contextual/energy.csv.
import aner.data
import aner.tensor
var schema = data.schema()
schema = data.column(schema, "row_id", "Int64", false)
schema = data.column(schema, "building_id", "String", false)
schema = data.column(schema, "temperature", "Float64", false)
schema = data.column(schema, "occupancy", "Float64", false)
schema = data.column(schema, "energy", "Float64", false)
let table = data.collect(data.scan_csv("examples/fixtures/contextual/energy.csv", schema, "NA"),
max_rows: 16, max_bytes: 1048576, batch_rows: 4)
let observations = data.frame(table, "row_id", "building_id", "energy",
List("", "", "degC", "1", "kWh"))
let populations = observations.partition_groups(
List("B0", "B1", "B2", "B3"), List("B4", "B5"), List("B6", "B7"))
print("Training, validation and test rows")
print(populations.train().rows())
print(populations.validation().rows())
print(populations.test().rows())
print("Training population role")
print(populations.train().role())
print("Numerical features exclude identity, grouping and target")
print(populations.train().features().cols())
let validation = populations.validation().batch(max_output_bytes: 1048576, copy: "allow")
print("First validation observation ID and target unit")
print(validation.row_id(0))
print(validation.targets().unit())
print("First validation temperature")
print(validation.inputs().value(0, 0))
Make it your experiment.
With Aner installed, save this program as examples/data_frames.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/data_frames.aner
aner run examples/data_frames.anerThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
Use native Aner 0.1.38 or newer with contextual data support on CPU Float64. Save the supplied synthetic fixture as examples/fixtures/contextual/energy.csv, preserving the directory structure, and run from the containing project folder.
Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution