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: Save datasets and corresponding metadata to cache.
  
  This method also saves as many data loading arguments as possible to help ensure
  that the cache contents are still relevant for future data loading calls. Refer
  to :meth:`~data.Dataset.load_cache` for more details.
  
  Arguments:
      datasets (list): List of datasets to cache.
      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.
docstr_tok: ["Save","datasets","and","corresponding","metadata","to","cache",".","This","method","also","saves","as","many","data","loading","arguments","as","possible","to","help","ensure","that","the","cache","contents","are","still","relevant","for","future","data","loading","calls",".","Refer","to",":","meth",":","`","~data.Dataset.load_cache","`","for","more","details",".","Arguments",":","datasets","(","list",")",":","List","of","datasets","to","cache",".","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","."]
code: def save_cache(
      datasets, fields, datafiles, cachefile, column_naming, state_args
  ):
      r"""Save datasets and corresponding metadata to cache.
  
      This method also saves as many data loading arguments as possible to help ensure
      that the cache contents are still relevant for future data loading calls. Refer
      to :meth:`~data.Dataset.load_cache` for more details.
  
      Arguments:
          datasets (list): List of datasets to cache.
          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.
      """
      examples = [dataset.examples for dataset in datasets]
      train_metadata = datasets[0].metadata
      datafiles_modified = [
          os.path.getmtime(datafile) for datafile in datafiles
      ]
      vocabs = {}
      field_args = {}
      reverse_fields = {}
      for name, field in six.iteritems(fields):
          reverse_fields[field] = name
  
      for field, name in six.iteritems(reverse_fields):
          if field is not None and hasattr(field, "vocab"):
              vocabs[name] = field.vocab
      for name, field in six.iteritems(fields):
          field_args[name] = None
          if field is not None:
              field_args[name] = field.preprocess_args()
  
      data = {
          "examples": examples,
          "train_metadata": train_metadata,
          "vocabs": vocabs,
          "datafiles": datafiles,
          "datafiles_modified": datafiles_modified,
          "field_args": field_args,
          "state_args": state_args,
          "column_naming": column_naming,
      }
      torch.save(data, cachefile)
  
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 7 for calling the MatchingDataset obj's underlying member method code with example usage: obj.save_cache(datasets, fields, datafiles, cachefile, column_naming, state_args) without return types