ClassifierResults

tsml_eval.evaluation.storage.ClassifierResults(dataset_name='N/A', classifier_name='N/A', split='N/A', resample_id=None, time_unit='nanoseconds', description='', parameters='No parameter info', fit_time=-1.0, predict_time=-1.0, benchmark_time=-1.0, memory_usage=-1.0, n_classes=None, error_estimate_method='N/A', error_estimate_time=-1.0, build_plus_estimate_time=-1.0, class_labels=None, predictions=None, probabilities=None, pred_times=None, pred_descriptions=None)[source]

A class for storing and managing results from classification experiments.

This class provides functionalities for storing classification results, including predictions, probabilities, and various performance metrics. It extends the EstimatorResults class, inheriting its base functionalities.

Parameters:
dataset_namestr, default=”N/A”

Name of the dataset used.

classifier_namestr, default=”N/A”

Name of the classifier used.

splitstr, default=”N/A”

Type of data split used, i.e. “train” or “test”.

resample_idint or None, default=None

Random seed used for the data resample, with 0 usually being the original data.

time_unitstr, default=”nanoseconds”

Time measurement used for other fields.

descriptionstr, default=””

Additional description of the classification experiment. Appended to the end of the first line of the results file.

parametersstr, default=”No parameter info”

Information about parameters used in the classifier and other build information. Written to the second line of the results file.

fit_timefloat, default=-1.0

Time taken fitting the model.

predict_timefloat, default=-1.0

Time taken making predictions.

benchmark_timefloat, default=-1.0

Time taken to run a simple benchmark function. In tsml-eval experiments, this is the time spent to sort 1,000 (seeded) random numpy arrays of size 20,000.

memory_usagefloat, default=-1.0

Memory usage during the experiment. In tsml-eval experiments, this is the peak memory usage during the fit method.

n_classesint or None, default=None

Number of classes in the dataset.

error_estimate_methodstr, default=”N/A”

Method used for train error/accuracy estimation (i.e. 10-fold CV, OOB error).

error_estimate_timefloat, default=-1.0

Time taken for train error/accuracy estimation.

build_plus_estimate_timefloat, default=-1.0

Total time for building the classifier and estimating error/accuracy on the train set. For certain methods this can be different from the sum of fit_time and error_estimate_time.

class_labelsarray-like or None, default=None

Actual class labels.

predictionsarray-like or None, default=None

Predicted class labels.

probabilitiesarray-like or None, default=None

Predicted class probabilities.

pred_timesarray-like or None, default=None

Prediction times for each case.

pred_descriptionslist of str or None, default=None

Descriptions for each prediction.

Attributes:
n_casesint or None

Number of cases in the dataset.

accuracyfloat or None

Accuracy of the classifier.

balanced_accuracyfloat or None

Balanced accuracy of the classifier.

auroc_scorefloat or None

Mean area under the ROC curve of the classifier.

log_lossfloat or None

Negative log likelihood of the classifier.

sensitivityfloat or None

Sensitivity of the classifier.

specificityfloat or None

Specificity of the classifier.

f1_scorefloat or None

F1 score of the classifier.

Examples

>>> from tsml_eval.evaluation.storage import ClassifierResults
>>> from tsml_eval.testing.testing_utils import _TEST_RESULTS_PATH
>>> cr = ClassifierResults().load_from_file(
...     _TEST_RESULTS_PATH +
...     "/classification/ROCKET/Predictions/Chinatown/testResample0.csv"
... )
>>> cr.calculate_statistics()
>>> acc = cr.accuracy