run_classification_experiment¶
- tsml_eval.experiments.run_classification_experiment(X_train: ndarray | list, y_train: ndarray, X_test: ndarray | list, y_test: ndarray, classifier, results_path, classifier_name=None, dataset_name='N/A', resample_id=None, data_transforms=None, transform_train_only=False, build_test_file=True, build_train_file=False, ignore_custom_train_estimate=False, attribute_file_path=None, att_max_shape=0, benchmark_time=True)[source]¶
Run a classification experiment and save the results to file.
Function to run a basic classification experiment for a <dataset>/<classifier>/<resample> combination and write the results to csv file(s) at a given location.
- Parameters:
- X_trainnp.ndarray or list of np.ndarray
The data to train the classifier. Numpy array or list of numpy arrays in the
aeondata format.- y_trainnp.array
Training data class labels. One label per case in the training data using the same ordering.
- X_testnp.ndarray or list of np.ndarray
The data used to test the trained classifier. Numpy array or list of numpy arrays in the
aeondata format.- y_testnp.array
Testing data class labels. One label per case in the testing data using the same ordering.
- classifierBaseClassifier
Classifier to be used in the experiment.
- results_pathstr
Location of where to write results. Any required directories will be created.
- classifier_namestr or None, default=None
Name of classifier used in writing results. If None, the name is taken from the classifier.
- dataset_namestr, default=”N/A”
Name of dataset.
- resample_idint or None, default=None
Seed for resampling. If set to 0, the default train/test split from file is used. Also used in output file name.
- data_transformstransformer, list of transformers or None, default=None
Transformer(s) to apply to the data before running the experiment. If a list, the transformers are applied in order. If None, no transformation is applied. Calls fit_transform on the training data and transform on the test data.
- transform_train_onlybool, default=False
if True, the data_transforms are limited to the training data only.
- build_test_filebool, default=True:
Whether to generate test files or not. If the classifier can generate its own train probabilities, the classifier will be built but no file will be output.
- build_train_filebool, default=False
Whether to generate train files or not. If true, it performs a 10-fold cross-validation on the train data and saves. If the classifier can produce its own estimates, those are used instead.
- ignore_custom_train_estimatebool, default=False
todo
- attribute_file_pathstr or None, default=None
todo (only test)
- att_max_shapeint, default=0
todo
- benchmark_timebool, default=True
Whether to benchmark the hardware used with a simple function and write the results. This will typically take ~2 seconds, but is hardware dependent.