class_docstr: A convenience class to access UCR/UEA time series datasets.
  
  When using one (or several) of these datasets in research projects, please
  cite [1]_.
  
  This class will attempt to recover from some known misnamed files, like the
  `StarLightCurves` dataset being provided in `StarlightCurves.zip` and
  alike.
  
  Parameters
  ----------
  use_cache : bool (default: True)
      Whether a cached version of the dataset should be used in
      :meth:`~load_dataset`, if one is found.
      Datasets are always cached upon loading, and this parameter only
      determines whether the cached version shall be refreshed upon loading.
  
  Notes
  -----
      Downloading dataset files can be time-consuming, it is recommended
      using `use_cache=True` (default) in order to only experience
      downloading time once per dataset and work on a cached version of the
      datasets afterward.
  
  See Also
  --------
  CachedDatasets : Provides pre-selected datasets for offline use.
  
  References
  ----------
  .. [1] A. Bagnall, J. Lines, W. Vickers and E. Keogh, The UEA & UCR Time
     Series Classification Repository, www.timeseriesclassification.com
class_docstr_tok: ["A","convenience","class","to","access","UCR\/UEA","time","series","datasets",".","When","using","one","(","or","several",")","of","these","datasets","in","research","projects",",","please","cite","[","1","]","_",".","This","class","will","attempt","to","recover","from","some","known","misnamed","files",",","like","the","`","StarLightCurves","`","dataset","being","provided","in","`","StarlightCurves.zip","`","and","alike",".","Parameters","--","--","--","--","--","use_cache",":","bool","(","default",":","True",")","Whether","a","cached","version","of","the","dataset","should","be","used","in",":","meth",":","`","~load_dataset","`",",","if","one","is","found",".","Datasets","are","always","cached","upon","loading",",","and","this","parameter","only","determines","whether","the","cached","version","shall","be","refreshed","upon","loading",".","Notes","--","--","-","Downloading","dataset","files","can","be","time-consuming",",","it","is","recommended","using","`","use_cache=True","`","(","default",")","in","order","to","only","experience","downloading","time","once","per","dataset","and","work","on","a","cached","version","of","the","datasets","afterward",".","See","Also","--","--","--","--","CachedDatasets",":","Provides","pre-selected","datasets","for","offline","use",".","References","--","--","--","--","--","..","[","1","]","A.","Bagnall",",","J",".","Lines",",","W.","Vickers","and","E.","Keogh",",","The","UEA","&","UCR","Time","Series","Classification","Repository",",","www.timeseriesclassification.com"]
docstr: Load a dataset from the UCR/UEA archive from its name.
  
  On failure, `None` is returned for each of the four values and a
  `RuntimeWarning` is printed.
  
  Parameters
  ----------
  dataset_name : str
      Name of the dataset. Should be in the list returned by
      `list_datasets`
  
  Returns
  -------
  numpy.ndarray of shape (n_ts_train, sz, d) or None
      Training time series. None if unsuccessful.
  numpy.ndarray of integers or strings with shape (n_ts_train, ) or None
      Training labels. None if unsuccessful.
  numpy.ndarray of shape (n_ts_test, sz, d) or None
      Test time series. None if unsuccessful.
  numpy.ndarray of integers or strings with shape (n_ts_test, ) or None
      Test labels. None if unsuccessful.
  
  Examples
  --------
  >>> data_loader = UCR_UEA_datasets()
  >>> X_train, y_train, X_test, y_test = data_loader.load_dataset(
  ...         "TwoPatterns")
  >>> X_train.shape
  (1000, 128, 1)
  >>> y_train.shape
  (1000,)
  >>> X_train, y_train, X_test, y_test = data_loader.load_dataset(
  ...         "Adiac")
  >>> X_train.shape
  (390, 176, 1)
  >>> X_train, y_train, X_test, y_test = data_loader.load_dataset(
  ...         "PenDigits")
  >>> X_train.shape
  (7494, 8, 2)
  >>> assert (None, None, None, None) == data_loader.load_dataset(
  ...         "DatasetThatDoesNotExist")
docstr_tok: ["Load","a","dataset","from","the","UCR\/UEA","archive","from","its","name",".","On","failure",",","`","None","`","is","returned","for","each","of","the","four","values","and","a","`","RuntimeWarning","`","is","printed",".","Parameters","--","--","--","--","--","dataset_name",":","str","Name","of","the","dataset",".","Should","be","in","the","list","returned","by","`","list_datasets","`","Returns","--","--","--","-","numpy.ndarray","of","shape","(","n_ts_train",",","sz",",","d",")","or","None","Training","time","series",".","None","if","unsuccessful",".","numpy.ndarray","of","integers","or","strings","with","shape","(","n_ts_train",",",")","or","None","Training","labels",".","None","if","unsuccessful",".","numpy.ndarray","of","shape","(","n_ts_test",",","sz",",","d",")","or","None","Test","time","series",".","None","if","unsuccessful",".","numpy.ndarray","of","integers","or","strings","with","shape","(","n_ts_test",",",")","or","None","Test","labels",".","None","if","unsuccessful",".","Examples","--","--","--","--",">",">",">","data_loader","=","UCR_UEA_datasets","(",")",">",">",">","X_train",",","y_train",",","X_test",",","y_test","=","data_loader.load_dataset","(","...","``","TwoPatterns","''",")",">",">",">","X_train.shape","(","1000",",","128",",","1",")",">",">",">","y_train.shape","(","1000",",",")",">",">",">","X_train",",","y_train",",","X_test",",","y_test","=","data_loader.load_dataset","(","...","``","Adiac","''",")",">",">",">","X_train.shape","(","390",",","176",",","1",")",">",">",">","X_train",",","y_train",",","X_test",",","y_test","=","data_loader.load_dataset","(","...","``","PenDigits","''",")",">",">",">","X_train.shape","(","7494",",","8",",","2",")",">",">",">","assert","(","None",",","None",",","None",",","None",")","==","data_loader.load_dataset","(","...","``","DatasetThatDoesNotExist","''",")"]
code: def load_dataset(self, dataset_name):
      """Load a dataset from the UCR/UEA archive from its name.
  
      On failure, `None` is returned for each of the four values and a
      `RuntimeWarning` is printed.
  
      Parameters
      ----------
      dataset_name : str
          Name of the dataset. Should be in the list returned by
          `list_datasets`
  
      Returns
      -------
      numpy.ndarray of shape (n_ts_train, sz, d) or None
          Training time series. None if unsuccessful.
      numpy.ndarray of integers or strings with shape (n_ts_train, ) or None
          Training labels. None if unsuccessful.
      numpy.ndarray of shape (n_ts_test, sz, d) or None
          Test time series. None if unsuccessful.
      numpy.ndarray of integers or strings with shape (n_ts_test, ) or None
          Test labels. None if unsuccessful.
  
      Examples
      --------
      >>> data_loader = UCR_UEA_datasets()
      >>> X_train, y_train, X_test, y_test = data_loader.load_dataset(
      ...         "TwoPatterns")
      >>> X_train.shape
      (1000, 128, 1)
      >>> y_train.shape
      (1000,)
      >>> X_train, y_train, X_test, y_test = data_loader.load_dataset(
      ...         "Adiac")
      >>> X_train.shape
      (390, 176, 1)
      >>> X_train, y_train, X_test, y_test = data_loader.load_dataset(
      ...         "PenDigits")
      >>> X_train.shape
      (7494, 8, 2)
      >>> assert (None, None, None, None) == data_loader.load_dataset(
      ...         "DatasetThatDoesNotExist")
      """
      dataset_name = self._filenames.get(dataset_name, dataset_name)
      full_path = os.path.join(self._data_dir, dataset_name)
  
      if not self._has_files(dataset_name) or not self.use_cache:
          # completely clear the target directory first, it will be created
          # by extract_from_zip_url if it does not exist
          try:
              # maybe it is a normal file (not a directory) for some obscure reason
              os.remove(full_path)
          except FileNotFoundError:
              pass  # nothing to do here, already deleted
          except IsADirectoryError:
              # we then need this function to recursively remove the directory:
              shutil.rmtree(full_path, ignore_errors=True)
          # else, actually raise the error!
  
          url = (
              "https://www.timeseriesclassification.com/aeon-toolkit/%s.zip"
              % dataset_name
          )
          success = extract_from_zip_url(url, target_dir=full_path)
          if not success:
              warnings.warn(
                  'dataset "%s" could not be downloaded or '
                  "extracted" % dataset_name,
                  category=RuntimeWarning,
                  stacklevel=2,
              )
              return None, None, None, None
  
      try:
          # if both TXT and ARFF files are provided, the TXT versions are
          # used
          # both training and test data must be available in the same format
          if self._has_files(dataset_name, ext="txt"):
              X_train, y_train = _load_txt_uea(
                  os.path.join(full_path, dataset_name + "_TRAIN.txt")
              )
              X_test, y_test = _load_txt_uea(
                  os.path.join(full_path, dataset_name + "_TEST.txt")
              )
          elif self._has_files(dataset_name, ext="arff"):
              X_train, y_train = _load_arff_uea(
                  os.path.join(full_path, dataset_name + "_TRAIN.arff")
              )
              X_test, y_test = _load_arff_uea(
                  os.path.join(full_path, dataset_name + "_TEST.arff")
              )
          else:
              warnings.warn(
                  'dataset "%s" is not provided in either TXT '
                  "or ARFF format and thus could not be loaded"
                  % dataset_name,
                  category=RuntimeWarning,
                  stacklevel=2,
              )
              return None, None, None, None
  
          return X_train, y_train, X_test, y_test
  
      except Exception as exception:
          warnings.warn(
              'dataset "%s" could be downloaded but not '
              "parsed: %s" % (dataset_name, str(exception)),
              category=RuntimeWarning,
              stacklevel=2,
          )
          return None, None, None, None
  
file_path: tslearn/tslearn/datasets/ucr_uea.py
imports: import os
  import warnings
  import csv
  import shutil
  from urllib.request import urlretrieve
  from tslearn.utils import _load_arff_uea, _load_txt_uea
  from .datasets import in_file_string_replace, extract_from_zip_url
label_desc: Use image node_id 7 for calling the UCR_UEA_datasets obj's underlying member method code with example usage: obj.load_dataset(dataset_name) and returns: X_train,  y_train,  X_test,  y_test, None,  None,  None,  None, None,  None,  None,  None, None,  None,  None,  None