(spanning_leaves, split_enum, valid_test_roots=None, **kwargs)
return split_graphs, roots
Split the classes of ILSVRC 2012 into train / valid / test.

  Each split will be represented as a sub-graph of the overall sampling graph.
  The leaves of a split's sub-graph are the ILSVRC 2012 synsets that are
  assigned to that split, and its internal nodes are all and only the ancestors
  of those leaves. Each split's subgraph is 'isolated' from the rest of the
  synsets in that following pointers of nodes in that sub-graph is guaranteed
  to lead to other nodes within in.

  If valid_test_roots is not None, it should contain two Synsets, that are the
  proposed roots of the validation and test subtrees. Otherwise, a proposal for
  these two roots is made in get_class_splits.

  Args:
    spanning_leaves: A dict mapping each Synset to the leaf Synsets that are
      reachable from it.
    split_enum: A class that inherits from enum.Enum whose attributes are TRAIN,
      VALID, and TEST, which are mapped to enumerated constants.
    valid_test_roots: dict that provides for each of 'valid' and 'test' a synset
      that is the ancestor of all and only the leaves that will be assigned to
      the corresponding split.
    **kwargs: keyword args for the function used to propose valid_test_roots,
      which will be called if split_classes is empty and no valid_test_roots are
      provided.

  Returns:
    splits: a dict mapping each Split in split_enum to the set of Synsets in the
      subgraph of that split. This is different from the split_classes dict,
      which contained lists of only the leaves of the corresponding graphs.
    roots: a dict of the same type as valid_test_roots. If it was provided, it
      is returned unchanged. Otherwise the newly created one is returned.
Split the classes of ILSVRC 2012 into train / valid / test.
Split the classes of ILSVRC 2012 into train / valid / test .
def create_splits(spanning_leaves, split_enum, valid_test_roots=None, **kwargs):
  """Split the classes of ILSVRC 2012 into train / valid / test.

  Each split will be represented as a sub-graph of the overall sampling graph.
  The leaves of a split's sub-graph are the ILSVRC 2012 synsets that are
  assigned to that split, and its internal nodes are all and only the ancestors
  of those leaves. Each split's subgraph is 'isolated' from the rest of the
  synsets in that following pointers of nodes in that sub-graph is guaranteed
  to lead to other nodes within in.

  If valid_test_roots is not None, it should contain two Synsets, that are the
  proposed roots of the validation and test subtrees. Otherwise, a proposal for
  these two roots is made in get_class_splits.

  Args:
    spanning_leaves: A dict mapping each Synset to the leaf Synsets that are
      reachable from it.
    split_enum: A class that inherits from enum.Enum whose attributes are TRAIN,
      VALID, and TEST, which are mapped to enumerated constants.
    valid_test_roots: dict that provides for each of 'valid' and 'test' a synset
      that is the ancestor of all and only the leaves that will be assigned to
      the corresponding split.
    **kwargs: keyword args for the function used to propose valid_test_roots,
      which will be called if split_classes is empty and no valid_test_roots are
      provided.

  Returns:
    splits: a dict mapping each Split in split_enum to the set of Synsets in the
      subgraph of that split. This is different from the split_classes dict,
      which contained lists of only the leaves of the corresponding graphs.
    roots: a dict of the same type as valid_test_roots. If it was provided, it
      is returned unchanged. Otherwise the newly created one is returned.
  """
  # The classes (leaf Synsets of the overall graph) of each split.
  split_classes, valid_test_roots = get_class_splits(
      spanning_leaves, valid_test_roots=valid_test_roots, **kwargs)

  # The copies of the leaf and desired root Synsets for each split. Copies are
  # needed since in each sub-graph those nodes will have different children /
  # parent lists.
  leaves, roots = init_split_subgraphs(split_classes, spanning_leaves,
                                       valid_test_roots)

  # Create the split sub-graphs as described above.
  train_graph = create_sampling_graph(leaves['train'])
  valid_graph = create_sampling_graph(leaves['valid'], root=roots['valid'])
  test_graph = create_sampling_graph(leaves['test'], root=roots['test'])
  split_graphs = {
      split_enum.TRAIN: train_graph,
      split_enum.VALID: valid_graph,
      split_enum.TEST: test_graph
  }
  return split_graphs, roots
def create_splits ( spanning_leaves , split_enum , valid_test_roots = None , * * kwargs ) : # The classes (leaf Synsets of the overall graph) of each split. split_classes , valid_test_roots = get_class_splits ( spanning_leaves , valid_test_roots = valid_test_roots , * * kwargs ) # The copies of the leaf and desired root Synsets for each split. Copies are # needed since in each sub-graph those nodes will have different children / # parent lists. leaves , roots = init_split_subgraphs ( split_classes , spanning_leaves , valid_test_roots ) # Create the split sub-graphs as described above. train_graph = create_sampling_graph ( leaves [ 'train' ] ) valid_graph = create_sampling_graph ( leaves [ 'valid' ] , root = roots [ 'valid' ] ) test_graph = create_sampling_graph ( leaves [ 'test' ] , root = roots [ 'test' ] ) split_graphs = { split_enum . TRAIN : train_graph , split_enum . VALID : valid_graph , split_enum . TEST : test_graph } return split_graphs , roots