code: def load_and_run_classification_experiment(
      problem_path,
      results_path,
      dataset,
      classifier,
      resample_id=0,
      cls_name=None,
      overwrite=False,
      build_train=False,
      predefined_resample=False,
  ):
      """Load a dataset and run a classification experiment.
  
      Method to run a basic experiment and write the results to files called
      testFold<resampleID>.csv and, if required, trainFold<resampleID>.csv.
  
      Parameters
      ----------
      problem_path : str
          Location of problem files, full path.
      results_path : str
          Location of where to write results. Any required directories will be created.
      dataset : str
          Name of problem. Files must be  <problem_path>/<dataset>/<dataset>+"_TRAIN.ts",
          same for "_TEST".
      classifier : BaseClassifier
          Classifier to be used in the experiment, if none is provided one is selected
          using cls_name using resample_id as a seed.
      cls_name : str, default = None
          Name of classifier used in writing results. If none the name is taken from
          the classifier
      resample_id : int, default=0
          Seed for resampling. If set to 0, the default train/test split from file is
          used. Also used in output file name.
      overwrite : bool, default=False
          If set to False, this will only build results if there is not a result file
          already present. If True, it will overwrite anything already there.
      build_train : bool, 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.
      predefined_resample : bool, default=False
          Read a predefined resample from file instead of performing a resample. If True
          the file format must include the resample_id at the end of the dataset name i.e.
          <problem_path>/<dataset>/<dataset>+<resample_id>+"_TRAIN.ts".
      """
      if cls_name is None:
          cls_name = type(classifier).__name__
      # Check which files exist, if both exist, exit
      build_test = True
      if not overwrite:
          full_path = (
              results_path
              + "/"
              + cls_name
              + "/Predictions/"
              + dataset
              + "/testResample"
              + str(resample_id)
              + ".csv"
          )
  
          if os.path.exists(full_path):
              build_test = False
  
          if build_train:
              full_path = (
                  results_path
                  + "/"
                  + cls_name
                  + "/Predictions/"
                  + dataset
                  + "/trainResample"
                  + str(resample_id)
                  + ".csv"
              )
  
              if os.path.exists(full_path):
                  build_train = False
  
          if build_train is False and not build_test:
              return
  
      if predefined_resample:
          X_train, y_train = load_ts(
              problem_path
              + dataset
              + "/"
              + dataset
              + str(resample_id)
              + "_TRAIN.ts"
          )
          X_test, y_test = load_ts(
              problem_path
              + dataset
              + "/"
              + dataset
              + str(resample_id)
              + "_TEST.ts"
          )
      else:
          X_train, y_train = load_ts(
              problem_path + dataset + "/" + dataset + "_TRAIN.ts"
          )
          X_test, y_test = load_ts(
              problem_path + dataset + "/" + dataset + "_TEST.ts"
          )
          if resample_id != 0:
              X_train, y_train, X_test, y_test = stratified_resample(
                  X_train, y_train, X_test, y_test, resample_id
              )
  
      run_classification_experiment(
          X_train,
          y_train,
          X_test,
          y_test,
          classifier,
          results_path,
          cls_name=cls_name,
          dataset=dataset,
          resample_id=resample_id,
          train_file=build_train,
          test_file=build_test,
      )
  
file_path: sktime/sktime/benchmarking/experiments.py
imports: import os
  import time
  from datetime import datetime
  import numpy
  from sklearn import preprocessing
  from sklearn.metrics import accuracy_score
  from sklearn.model_selection import cross_val_predict
  from sktime.datasets import load_from_tsfile_to_dataframe
  from sktime.datasets import write_results_to_uea_format
  from sktime.utils.sampling import stratified_resample
label_desc: Use image node_id 4 for calling a global function with example usage: load_and_run_classification_experiment(problem_path, results_path, dataset, classifier, resample_id, cls_name, overwrite, build_train, predefined_resample) without return types