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 Path coercible
The path to the file to save to or load
Methods
is_applicable(path)Check if the storage handler is applicable for the given path.
load()Load the results from a file.
save(results)Save the results to a JSON file.
- save(results: list[ResultObject])[source]#
Save the results to a JSON file.
- Parameters:
- resultsResultObject
The results to save.