Dataset Declarations¶
A dataset declaration loads data from a JSON file and extracts a specific field for use in evaluations.
Syntax¶
| Component | Required | Description |
|---|---|---|
FILE_REFERENCE |
Yes | An identifier referencing a previously declared file |
key |
Optional | The JSON field to extract from the loaded data |
model |
Optional | A model to associate with this dataset for lineage tracking |
How datasets work¶
When a dataset is declared, AISL:
- Resolves the file reference to find the JSON file on disk
- Loads and parses the JSON content
- Extracts the array at the specified
key - Stores the result as an array accessible by the dataset name
Examples¶
Loading ground truth and predictions from a file:
declare data_file as file { name = results, type = json }
declare ground_truth as dataset { data_file, key = y_true }
declare predictions as dataset { data_file, key = y_pred, model = resnet50 }
Given a JSON file results.json with this structure:
The ground_truth dataset would contain [0, 1, 1, 0, 1] and predictions
would contain [0, 1, 0, 0, 1].
Using datasets¶
Datasets can be used directly as arguments to built-in functions:
You can also transform dataset values before use:
let y_true = argmax(ground_truth);
let y_pred = argmax(predictions);
let flat = flatten(ground_truth);
Model association¶
Linking a dataset to a model via the model option records a lineage
relationship in the object graph. This tracks that the data in the dataset was
produced by that model: