write_classification_results

tsml_eval.utils.results_writing.write_classification_results(predictions, probabilities, class_labels, classifier_name, dataset_name, file_path, full_path=True, first_line_classifier_name=None, split=None, resample_id=None, time_unit='N/A', first_line_comment=None, parameter_info='No Parameter Info', accuracy=-1, fit_time=-1, predict_time=-1, benchmark_time=-1, memory_usage=-1, n_classes=-1, train_estimate_method='', train_estimate_time=-1, fit_and_estimate_time=-1)[source]

Write the predictions for a classification experiment in the format used by tsml.

Parameters:
predictionsnp.array

The predicted values to write to file. Must be the same length as labels.

probabilitiesnp.ndarray

Estimated class probabilities. These are written after the predicted values for each case.

class_labelsnp.array

The actual class values written to file with the predicted values.

classifier_namestr

Name of the classifier that made the predictions. Written to file and can determine file structure if full_path is False.

dataset_namestr

Name of the problem the classifier was built on.

file_pathstr

Path to write the results file to or the directory to build the default file structure if full_path is False.

full_pathboolean, default=True

If True, results are written directly to the directory passed in file_path. If False, then a standard file structure using the classifier and dataset names is created and used to write the results file.

first_line_classifier_namestr or None, default=None

Alternative name for the classifier to be written to the file. If None, the classifier_name is used. Useful if full_path is False and extra information is wanted in the classifier name (i.e. and alias and class name)

splitstr or None, default=None

Either None, ‘TRAIN’ or ‘TEST’. Influences the result file name and first line of the file.

resample_idint or None, default=None

Indicates what random seed was used to resample the data or used as a random_state for the classifier.

time_unitstr, default=”N/A”

The format used for timings in the file, i.e. ‘Seconds’, ‘Milliseconds’, ‘Nanoseconds’

first_line_commentstr or None, default=None

Optional comment appended to the end of the first line, i.e. the file used to generate the results.

parameter_infostr, default=”No Parameter Info”

Unstructured estimator dependant information, i.e. estimator parameters or values from the model build.

accuracy: float, default=-1

The accuracy of the predictions.

fit_timeint, default=-1

The time taken to fit the classifier.

predict_timeint, default=-1

The time taken to predict the class labels.

benchmark_timeint, default=-1

A benchmark time for the hardware used to scale other timings.

memory_usageint, default=-1

The memory usage of the classifier.

n_classesint, default=-1

The number of classes in the dataset.

train_estimate_methodstr, default=””

The method used to generate predictions for results on training data.

train_estimate_timeint, default=-1

The time taken to generate predictions for results on training data.

fit_and_estimate_timeint, default=-1

The time taken to fit the classifier to build and generate predictions for results on training data.

This is not necessarily always going to be fit_time + train_estimate_time, i.e. if an estimate requires the model to be fit, fit_time would be included in the train_estimate_time value. In this case fit_time + train_estimate_time would time fitting the model twice.