class_docstr: Represents dataset with associated metadata.
  
  Holds all information about one split of a dataset (e.g. training set).
  
  Attributes:
      fields (dict): A mapping from attribute names (e.g. "left_address") to
          corresponding :class:`~data.MatchingField` objects that specify how to process
          the field.
      examples (list): A list containing all the examples (labeled tuple pairs) in this
          dataset.
      metadata (dict): Metadata about the dataset (e.g. word probabilities).
          See :meth:`~data.MatchingDataset.compute_metadata` for details.
      corresponding_field (dict): A mapping from left table attribute names
          (e.g. "left_address") to corresponding right table attribute names
          (e.g. "right_address") and vice versa.
      text_fields (dict): A mapping from canonical attribute names (e.g. "address") to
          tuples of the corresponding left and right attribute names
          (e.g. ("left_address", "right_address")).
      all_left_fields (list): A list of all left table attribute names.
      all_right_fields (list): A list of all right table attribute names.
      canonical_text_fields (list): A list of all canonical attribute names.
      label_field (str): Name of the column containing labels.
      id_field (str): Name of the column containing tuple pair ids.
class_docstr_tok: ["Represents","dataset","with","associated","metadata",".","Holds","all","information","about","one","split","of","a","dataset","(","e.g",".","training","set",")",".","Attributes",":","fields","(","dict",")",":","A","mapping","from","attribute","names","(","e.g",".","``","left_address","''",")","to","corresponding",":","class",":","`","~data.MatchingField","`","objects","that","specify","how","to","process","the","field",".","examples","(","list",")",":","A","list","containing","all","the","examples","(","labeled","tuple","pairs",")","in","this","dataset",".","metadata","(","dict",")",":","Metadata","about","the","dataset","(","e.g",".","word","probabilities",")",".","See",":","meth",":","`","~data.MatchingDataset.compute_metadata","`","for","details",".","corresponding_field","(","dict",")",":","A","mapping","from","left","table","attribute","names","(","e.g",".","``","left_address","''",")","to","corresponding","right","table","attribute","names","(","e.g",".","``","right_address","''",")","and","vice","versa",".","text_fields","(","dict",")",":","A","mapping","from","canonical","attribute","names","(","e.g",".","``","address","''",")","to","tuples","of","the","corresponding","left","and","right","attribute","names","(","e.g",".","(","``","left_address","''",",","``","right_address","''",")",")",".","all_left_fields","(","list",")",":","A","list","of","all","left","table","attribute","names",".","all_right_fields","(","list",")",":","A","list","of","all","right","table","attribute","names",".","canonical_text_fields","(","list",")",":","A","list","of","all","canonical","attribute","names",".","label_field","(","str",")",":","Name","of","the","column","containing","labels",".","id_field","(","str",")",":","Name","of","the","column","containing","tuple","pair","ids","."]
docstr: Load datasets and corresponding metadata from cache.
  
  This method also checks whether any of the data loading arguments have changes
  that make the cache contents invalid. The following kinds of changes are currently
  detected automatically:
  
  * Data filename changes (e.g. different train filename)
  * Data file modifications (e.g. train data modified)
  * Column changes (e.g. using a different subset of columns in CSV file)
  * Column specification changes (e.g. changing lowercasing behavior)
  * Column naming convention changes (e.g. different labeled data column)
  
  Arguments:
      fields (dict): Mapping from attribute names (e.g. "left_address") to
          corresponding :class:`~data.MatchingField` objects that specify how to
          process the field.
      datafiles (list): A list of the data files.
      cachefile (str): The cache file path.
      column_naming (dict): A `dict` containing column naming conventions. See
          `__init__` for details.
      state_args (dict): A `dict` containing other information about the state under
          which the cache was created.
  
  Returns:
      Tuple containing unprocessed cache data dict and a list of cache staleness
      causes, if any.
  
  .. warning::
      Note that if a column specification, i.e., arguments to
      :class:`~data.MatchingField` include callable arguments (e.g. lambdas or
      functions) these arguments cannot be serialized and hence will not be checked
      for modifications.
docstr_tok: ["Load","datasets","and","corresponding","metadata","from","cache",".","This","method","also","checks","whether","any","of","the","data","loading","arguments","have","changes","that","make","the","cache","contents","invalid",".","The","following","kinds","of","changes","are","currently","detected","automatically",":","*","Data","filename","changes","(","e.g",".","different","train","filename",")","*","Data","file","modifications","(","e.g",".","train","data","modified",")","*","Column","changes","(","e.g",".","using","a","different","subset","of","columns","in","CSV","file",")","*","Column","specification","changes","(","e.g",".","changing","lowercasing","behavior",")","*","Column","naming","convention","changes","(","e.g",".","different","labeled","data","column",")","Arguments",":","fields","(","dict",")",":","Mapping","from","attribute","names","(","e.g",".","``","left_address","''",")","to","corresponding",":","class",":","`","~data.MatchingField","`","objects","that","specify","how","to","process","the","field",".","datafiles","(","list",")",":","A","list","of","the","data","files",".","cachefile","(","str",")",":","The","cache","file","path",".","column_naming","(","dict",")",":","A","`","dict","`","containing","column","naming","conventions",".","See","`","__init__","`","for","details",".","state_args","(","dict",")",":","A","`","dict","`","containing","other","information","about","the","state","under","which","the","cache","was","created",".","Returns",":","Tuple","containing","unprocessed","cache","data","dict","and","a","list","of","cache","staleness","causes",",","if","any",".","..","warning",":",":","Note","that","if","a","column","specification",",","i.e.",",","arguments","to",":","class",":","`","~data.MatchingField","`","include","callable","arguments","(","e.g",".","lambdas","or","functions",")","these","arguments","can","not","be","serialized","and","hence","will","not","be","checked","for","modifications","."]
code: def load_cache(
      fields, datafiles, cachefile, column_naming, state_args
  ):
      r"""Load datasets and corresponding metadata from cache.
  
      This method also checks whether any of the data loading arguments have changes
      that make the cache contents invalid. The following kinds of changes are currently
      detected automatically:
  
      * Data filename changes (e.g. different train filename)
      * Data file modifications (e.g. train data modified)
      * Column changes (e.g. using a different subset of columns in CSV file)
      * Column specification changes (e.g. changing lowercasing behavior)
      * Column naming convention changes (e.g. different labeled data column)
  
      Arguments:
          fields (dict): Mapping from attribute names (e.g. "left_address") to
              corresponding :class:`~data.MatchingField` objects that specify how to
              process the field.
          datafiles (list): A list of the data files.
          cachefile (str): The cache file path.
          column_naming (dict): A `dict` containing column naming conventions. See
              `__init__` for details.
          state_args (dict): A `dict` containing other information about the state under
              which the cache was created.
  
      Returns:
          Tuple containing unprocessed cache data dict and a list of cache staleness
          causes, if any.
  
      .. warning::
          Note that if a column specification, i.e., arguments to
          :class:`~data.MatchingField` include callable arguments (e.g. lambdas or
          functions) these arguments cannot be serialized and hence will not be checked
          for modifications.
      """
      cached_data = torch.load(cachefile)
      cache_stale_cause = set()
  
      if datafiles != cached_data["datafiles"]:
          cache_stale_cause.add("Data file list has changed.")
  
      datafiles_modified = [
          os.path.getmtime(datafile) for datafile in datafiles
      ]
      if datafiles_modified != cached_data["datafiles_modified"]:
          cache_stale_cause.add(
              "One or more data files have been modified."
          )
  
      if set(fields.keys()) != set(cached_data["field_args"].keys()):
          cache_stale_cause.add("Fields have changed.")
  
      for name, field in six.iteritems(fields):
          none_mismatch = (field is None) != (
              cached_data["field_args"][name] is None
          )
          args_mismatch = False
          if (
              field is not None
              and cached_data["field_args"][name] is not None
          ):
              args_mismatch = (
                  field.preprocess_args()
                  != cached_data["field_args"][name]
              )
          if none_mismatch or args_mismatch:
              cache_stale_cause.add("Field arguments have changed.")
          if field is not None and not isinstance(field, MatchingField):
              cache_stale_cause.add("Cache update required.")
  
      if column_naming != cached_data["column_naming"]:
          cache_stale_cause.add("Other arguments have changed.")
  
      cache_stale_cause.update(
          MatchingDataset.state_args_compatibility(
              state_args, cached_data["state_args"]
          )
      )
  
      return cached_data, cache_stale_cause
  
imports: from __future__ import division
  import copy
  import logging
  import os
  import pdb
  from collections import Counter, defaultdict
  from timeit import default_timer
  import pandas
  import pyprind
  import six
  from sklearn.decomposition import TruncatedSVD
  import torch
  import torch.nn
  from torchtext.legacy import data
  from torchtext.legacy.data.example import Example
  from torchtext.utils import unicode_csv_reader
  from ..models.modules import NoMeta, Pool
  from .field import MatchingField
  from .iterator import MatchingIterator
label_desc: Use image node_id 8 for calling the MatchingDataset obj's underlying member method code with example usage: obj.load_cache(fields, datafiles, cachefile, column_naming, state_args) and returns: cached_data,  cache_stale_cause