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: Creates a MatchingDataset.
  
  Creates a MatchingDataset by performing the following, if `examples` parameter is
  not specified:
  
  #. Read each example (tuple pair) in specified CSV file.
  #. Preprocess example. Involves lowercasing and tokenization (unless disabled).
  #. Compute metadata. See :meth:`~data.MatchingDataset.compute_metadata` for
      details.
  
  If `examples` is specified, initializes MatchingDataset from given `examples`
  and `metadata` arguments.
  
  Arguments:
      fields (list(tuple(str, MatchingField))): A list of tuples containing column
          name (e.g. "left_address") and corresponding :class:`~data.MatchingField`
          pairs, in the same order that the columns occur in the CSV file. Tuples of
          (name, None) represent columns that will be ignored.
      column_naming (dict): A `dict` containing the following keys:
          * ``id``: The name of the tuple pair ID column.
          * ``label``: The name of the tuple pair match label column.
          * ``left``: The prefix for attribute names belonging to the left table.
          * ``right``: The prefix for attribute names belonging to the right table.
      path (str): Path to the data file. Must be specified if `examples` is None.
      format (str): The format of the data file. One of "CSV" or "TSV".
      examples (list): A list containing all the examples (labeled tuple pairs) in
          this dataset. Must be specified if `path` is None.
      metadata (dict): Metadata about the dataset (e.g. word probabilities).
          See :meth:`~data.MatchingDataset.compute_metadata` for details.
      filter_pred (callable or None): Use only examples for which
          filter_pred(example) is True, or use all examples if None.
          Default is None. This is a keyword-only parameter.
docstr_tok: ["Creates","a","MatchingDataset",".","Creates","a","MatchingDataset","by","performing","the","following",",","if","`","examples","`","parameter","is","not","specified",":","#",".","Read","each","example","(","tuple","pair",")","in","specified","CSV","file",".","#",".","Preprocess","example",".","Involves","lowercasing","and","tokenization","(","unless","disabled",")",".","#",".","Compute","metadata",".","See",":","meth",":","`","~data.MatchingDataset.compute_metadata","`","for","details",".","If","`","examples","`","is","specified",",","initializes","MatchingDataset","from","given","`","examples","`","and","`","metadata","`","arguments",".","Arguments",":","fields","(","list","(","tuple","(","str",",","MatchingField",")",")",")",":","A","list","of","tuples","containing","column","name","(","e.g",".","``","left_address","''",")","and","corresponding",":","class",":","`","~data.MatchingField","`","pairs",",","in","the","same","order","that","the","columns","occur","in","the","CSV","file",".","Tuples","of","(","name",",","None",")","represent","columns","that","will","be","ignored",".","column_naming","(","dict",")",":","A","`","dict","`","containing","the","following","keys",":","*","``","id","``",":","The","name","of","the","tuple","pair","ID","column",".","*","``","label","``",":","The","name","of","the","tuple","pair","match","label","column",".","*","``","left","``",":","The","prefix","for","attribute","names","belonging","to","the","left","table",".","*","``","right","``",":","The","prefix","for","attribute","names","belonging","to","the","right","table",".","path","(","str",")",":","Path","to","the","data","file",".","Must","be","specified","if","`","examples","`","is","None",".","format","(","str",")",":","The","format","of","the","data","file",".","One","of","``","CSV","''","or","``","TSV","''",".","examples","(","list",")",":","A","list","containing","all","the","examples","(","labeled","tuple","pairs",")","in","this","dataset",".","Must","be","specified","if","`","path","`","is","None",".","metadata","(","dict",")",":","Metadata","about","the","dataset","(","e.g",".","word","probabilities",")",".","See",":","meth",":","`","~data.MatchingDataset.compute_metadata","`","for","details",".","filter_pred","(","callable","or","None",")",":","Use","only","examples","for","which","filter_pred","(","example",")","is","True",",","or","use","all","examples","if","None",".","Default","is","None",".","This","is","a","keyword-only","parameter","."]
code: def __init__(
      self,
      fields,
      column_naming,
      path=None,
      format="csv",
      examples=None,
      metadata=None,
      **kwargs,
  ):
      r"""Creates a MatchingDataset.
  
      Creates a MatchingDataset by performing the following, if `examples` parameter is
      not specified:
  
      #. Read each example (tuple pair) in specified CSV file.
      #. Preprocess example. Involves lowercasing and tokenization (unless disabled).
      #. Compute metadata. See :meth:`~data.MatchingDataset.compute_metadata` for
          details.
  
      If `examples` is specified, initializes MatchingDataset from given `examples`
      and `metadata` arguments.
  
      Arguments:
          fields (list(tuple(str, MatchingField))): A list of tuples containing column
              name (e.g. "left_address") and corresponding :class:`~data.MatchingField`
              pairs, in the same order that the columns occur in the CSV file. Tuples of
              (name, None) represent columns that will be ignored.
          column_naming (dict): A `dict` containing the following keys:
              * ``id``: The name of the tuple pair ID column.
              * ``label``: The name of the tuple pair match label column.
              * ``left``: The prefix for attribute names belonging to the left table.
              * ``right``: The prefix for attribute names belonging to the right table.
          path (str): Path to the data file. Must be specified if `examples` is None.
          format (str): The format of the data file. One of "CSV" or "TSV".
          examples (list): A list containing all the examples (labeled tuple pairs) in
              this dataset. Must be specified if `path` is None.
          metadata (dict): Metadata about the dataset (e.g. word probabilities).
              See :meth:`~data.MatchingDataset.compute_metadata` for details.
          filter_pred (callable or None): Use only examples for which
              filter_pred(example) is True, or use all examples if None.
              Default is None. This is a keyword-only parameter.
      """
      if examples is None:
          make_example = {
              "json": Example.fromJSON,
              "dict": Example.fromdict,
              "tsv": Example.fromCSV,
              "csv": Example.fromCSV,
          }[format.lower()]
  
          lines = 0
          with open(os.path.expanduser(path), encoding="utf8") as f:
              for line in f:
                  lines += 1
  
          with open(os.path.expanduser(path), encoding="utf8") as f:
              if format == "csv":
                  reader = unicode_csv_reader(f)
              elif format == "tsv":
                  reader = unicode_csv_reader(f, delimiter="\t")
              else:
                  reader = f
  
              next(reader)
              examples = [
                  make_example(line, fields)
                  for line in pyprind.prog_bar(
                      reader,
                      iterations=lines,
                      title='\nReading and processing data from "'
                      + path
                      + '"',
                  )
              ]
  
          super(MatchingDataset, self).__init__(
              examples, fields, **kwargs
          )
      else:
          self.fields = dict(fields)
          self.examples = examples
          self.metadata = metadata
  
      self.path = path
      self.column_naming = column_naming
      self._set_attributes()
  
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 1 to create a new MatchingDataset object from inherited base classes: data with example: obj = MatchingDataset(fields, column_naming, path, format, examples, metadata)