class_docstr: Random split based on groupings.
  
  A splitter class that splits on groupings. An example use case is when
  there are multiple conformations of the same molecule that share the same
  topology.  This splitter subsequently guarantees that resulting splits
  preserve groupings.
  
  Note that it doesn't do any dynamic programming or something fancy to try
  to maximize the choice such that frac_train, frac_valid, or frac_test is
  maximized.  It simply permutes the groups themselves. As such, use with
  caution if the number of elements per group varies significantly.
  
  Examples
  --------
  >>> import deepchem as dc
  >>> import numpy as np
  >>> X=np.arange(12)
  >>> groups = [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3]
  >>> splitter = dc.splits.RandomGroupSplitter(groups=groups)
  >>> dataset = dc.data.NumpyDataset(X)   # 12 elements
  >>> train, test = splitter.train_test_split(dataset, frac_train=0.75, seed=0)
  >>> print (train.ids) #array([6, 7, 8, 9, 10, 11, 3, 4, 5], dtype=object)
  [6 7 8 9 10 11 3 4 5]
class_docstr_tok: ["Random","split","based","on","groupings",".","A","splitter","class","that","splits","on","groupings",".","An","example","use","case","is","when","there","are","multiple","conformations","of","the","same","molecule","that","share","the","same","topology",".","This","splitter","subsequently","guarantees","that","resulting","splits","preserve","groupings",".","Note","that","it","does","n't","do","any","dynamic","programming","or","something","fancy","to","try","to","maximize","the","choice","such","that","frac_train",",","frac_valid",",","or","frac_test","is","maximized",".","It","simply","permutes","the","groups","themselves",".","As","such",",","use","with","caution","if","the","number","of","elements","per","group","varies","significantly",".","Examples","--","--","--","--",">",">",">","import","deepchem","as","dc",">",">",">","import","numpy","as","np",">",">",">","X=np.arange","(","12",")",">",">",">","groups","=","[","0",",","0",",","0",",","1",",","1",",","1",",","2",",","2",",","2",",","3",",","3",",","3","]",">",">",">","splitter","=","dc.splits.RandomGroupSplitter","(","groups=groups",")",">",">",">","dataset","=","dc.data.NumpyDataset","(","X",")","#","12","elements",">",">",">","train",",","test","=","splitter.train_test_split","(","dataset",",","frac_train=0.75",",","seed=0",")",">",">",">","print","(","train.ids",")","#","array","(","[","6",",","7",",","8",",","9",",","10",",","11",",","3",",","4",",","5","]",",","dtype=object",")","[","6","7","8","9","10","11","3","4","5","]"]
docstr: Initialize this object.
  
  Parameters
  ----------
  groups: Sequence
      An array indicating the group of each item.
      The length is equals to `len(dataset.X)`
  
  Note
  ----
  The examples of groups is the following.
  
  | groups    : 3 2 2 0 1 1 2 4 3
  | dataset.X : 0 1 2 3 4 5 6 7 8
  
  | groups    : a b b e q x a a r
  | dataset.X : 0 1 2 3 4 5 6 7 8
docstr_tok: ["Initialize","this","object",".","Parameters","--","--","--","--","--","groups",":","Sequence","An","array","indicating","the","group","of","each","item",".","The","length","is","equals","to","`","len","(","dataset.X",")","`","Note","--","--","The","examples","of","groups","is","the","following",".","|","groups",":","3","2","2","0","1","1","2","4","3","|","dataset.X",":","0","1","2","3","4","5","6","7","8","|","groups",":","a","b","b","e","q","x","a","a","r","|","dataset.X",":","0","1","2","3","4","5","6","7","8"]
code: def __init__(self, groups: Sequence):
      """Initialize this object.
  
      Parameters
      ----------
      groups: Sequence
          An array indicating the group of each item.
          The length is equals to `len(dataset.X)`
  
      Note
      ----
      The examples of groups is the following.
  
      | groups    : 3 2 2 0 1 1 2 4 3
      | dataset.X : 0 1 2 3 4 5 6 7 8
  
      | groups    : a b b e q x a a r
      | dataset.X : 0 1 2 3 4 5 6 7 8
      """
      self.groups = groups
  
imports: import inspect
  import itertools
  import logging
  import os
  import random
  import tempfile
  from typing import Any, Dict, Iterator, List, Optional, Sequence, Tuple, Union
  import deepchem
  import numpy
  import pandas
  from deepchem.data import Dataset, DiskDataset
  from deepchem.utils import get_print_threshold
label_desc: Use image node_id 1 to create a new RandomGroupSplitter object from inherited base classes: Splitter with example: obj = RandomGroupSplitter(groups)