JSONStorageHandler
JSONStorageHandler
- class JSONStorageHandler(path)[source]
Storage handler for JSON files, with ending .json.
Loads and saves results in JSON format, as follows.
Each result is stored as a JSON record with the following keys:
model_id: The ID of the model.validation_id: The ID of the validation run.folds: A dictionary of fold results,where each key is a fold ID and the value is a dictionary of scores and dataframes.
The
foldsdictionary has the following structure, whereground_truth,predictions, andtrain_dataare returned only if they were requested during benchmarking.Keys are strings representing fold IDs.
- “0”: {
- “scores”: {
“accuracy”: 0.9, “f1_score”: 0.8
}, “ground_truth”: {
“column1”: [1, 0, 1], “column2”: [0.5, 0.3, 0.8]
}, “predictions”: {
“column1”: [1, 0, 0], “column2”: [0.6, 0.4, 0.7]
}, “train_data”: {
“column1”: [0, 1, 1], “column2”: [0.2, 0.9, 0.4]
}
}, “1”: {
…
}
}
- Parameters:
- pathstr or pathlib.Path
Path to the JSON results file. Must refer to a file with a
.jsonextension, not a directory.
Methods
deserialize_result(row)Deserialize a ResultObject from the JSON storage format.
is_applicable(path)Return whether this handler supports the given results file path.
load()Load benchmark results from the file at
self.path.save(results)Save benchmark results to the JSON file at
self.path.serialize_result(result)Serialize a ResultObject to the JSON storage format.

