class_docstr: Class for doing data splits based on the Tanimoto similarity between ECFP4
  fingerprints.
  
  This class tries to split the data such that the molecules in each dataset are
  as different as possible from the ones in the other datasets.  This makes it a
  very stringent test of models.  Predicting the test and validation sets may
  require extrapolating far outside the training data.
  
  The running time for this splitter scales as O(n^2) in the number of samples.
  Splitting large datasets can take a long time.
  
  Note
  ----
  This class requires RDKit to be installed.
  
  Examples
  --------
  >>> import deepchem as dc
  >>> import numpy as np
  >>> # creation of demo data set with some smiles strings
  >>> smiles= ['C', 'CC', 'CCC', 'CCCC', 'CCCCC']
  >>> Xs = np.zeros(len(smiles))
  >>> # creation of a deepchem dataset with the smile codes in the ids field
  >>> dataset = dc.data.DiskDataset.from_numpy(X=Xs,ids=smiles)
  >>> fingerprintsplitter = dc.splits.FingerprintSplitter()
  >>> train_dataset, test_dataset = fingerprintsplitter.train_test_split(dataset)
  >>> print(train_dataset.ids)
  ['C' 'CCCCC' 'CCCC' 'CCC']
  >>> print(test_dataset.ids)
  ['CC']
class_docstr_tok: ["Class","for","doing","data","splits","based","on","the","Tanimoto","similarity","between","ECFP4","fingerprints",".","This","class","tries","to","split","the","data","such","that","the","molecules","in","each","dataset","are","as","different","as","possible","from","the","ones","in","the","other","datasets",".","This","makes","it","a","very","stringent","test","of","models",".","Predicting","the","test","and","validation","sets","may","require","extrapolating","far","outside","the","training","data",".","The","running","time","for","this","splitter","scales","as","O","(","n^2",")","in","the","number","of","samples",".","Splitting","large","datasets","can","take","a","long","time",".","Note","--","--","This","class","requires","RDKit","to","be","installed",".","Examples","--","--","--","--",">",">",">","import","deepchem","as","dc",">",">",">","import","numpy","as","np",">",">",">","#","creation","of","demo","data","set","with","some","smiles","strings",">",">",">","smiles=","[","'","C","'",",","'CC","'",",","'CCC","'",",","'CCCC","'",",","'CCCCC","'","]",">",">",">","Xs","=","np.zeros","(","len","(","smiles",")",")",">",">",">","#","creation","of","a","deepchem","dataset","with","the","smile","codes","in","the","ids","field",">",">",">","dataset","=","dc.data.DiskDataset.from_numpy","(","X=Xs",",","ids=smiles",")",">",">",">","fingerprintsplitter","=","dc.splits.FingerprintSplitter","(",")",">",">",">","train_dataset",",","test_dataset","=","fingerprintsplitter.train_test_split","(","dataset",")",">",">",">","print","(","train_dataset.ids",")","[","'","C","'","'CCCCC","'","'CCCC","'","'CCC","'","]",">",">",">","print","(","test_dataset.ids",")","[","'CC","'","]"]
docstr: Splits compounds into training, validation, and test sets based on the
  Tanimoto similarity of their ECFP4 fingerprints. This splitting algorithm
  has an O(N^2) run time, where N is the number of elements in the dataset.
  
  Parameters
  ----------
  dataset: Dataset
      Dataset to be split.
  frac_train: float, optional (default 0.8)
      The fraction of data to be used for the training split.
  frac_valid: float, optional (default 0.1)
      The fraction of data to be used for the validation split.
  frac_test: float, optional (default 0.1)
      The fraction of data to be used for the test split.
  seed: int, optional (default None)
      Random seed to use (ignored since this algorithm is deterministic).
  log_every_n: int, optional (default None)
      Log every n examples (not currently used).
  
  Returns
  -------
  Tuple[List[int], List[int], List[int]]
      A tuple of train indices, valid indices, and test indices.
docstr_tok: ["Splits","compounds","into","training",",","validation",",","and","test","sets","based","on","the","Tanimoto","similarity","of","their","ECFP4","fingerprints",".","This","splitting","algorithm","has","an","O","(","N^2",")","run","time",",","where","N","is","the","number","of","elements","in","the","dataset",".","Parameters","--","--","--","--","--","dataset",":","Dataset","Dataset","to","be","split",".","frac_train",":","float",",","optional","(","default","0.8",")","The","fraction","of","data","to","be","used","for","the","training","split",".","frac_valid",":","float",",","optional","(","default","0.1",")","The","fraction","of","data","to","be","used","for","the","validation","split",".","frac_test",":","float",",","optional","(","default","0.1",")","The","fraction","of","data","to","be","used","for","the","test","split",".","seed",":","int",",","optional","(","default","None",")","Random","seed","to","use","(","ignored","since","this","algorithm","is","deterministic",")",".","log_every_n",":","int",",","optional","(","default","None",")","Log","every","n","examples","(","not","currently","used",")",".","Returns","--","--","--","-","Tuple","[","List","[","int","]",",","List","[","int","]",",","List","[","int","]","]","A","tuple","of","train","indices",",","valid","indices",",","and","test","indices","."]
code: def split(
      self,
      dataset: Dataset,
      frac_train: float = 0.8,
      frac_valid: float = 0.1,
      frac_test: float = 0.1,
      seed: Optional[int] = None,
      log_every_n: Optional[int] = None,
  ) -> Tuple[List[int], List[int], List[int]]:
      """
      Splits compounds into training, validation, and test sets based on the
      Tanimoto similarity of their ECFP4 fingerprints. This splitting algorithm
      has an O(N^2) run time, where N is the number of elements in the dataset.
  
      Parameters
      ----------
      dataset: Dataset
          Dataset to be split.
      frac_train: float, optional (default 0.8)
          The fraction of data to be used for the training split.
      frac_valid: float, optional (default 0.1)
          The fraction of data to be used for the validation split.
      frac_test: float, optional (default 0.1)
          The fraction of data to be used for the test split.
      seed: int, optional (default None)
          Random seed to use (ignored since this algorithm is deterministic).
      log_every_n: int, optional (default None)
          Log every n examples (not currently used).
  
      Returns
      -------
      Tuple[List[int], List[int], List[int]]
          A tuple of train indices, valid indices, and test indices.
      """
      try:
          from rdkit import Chem
          from rdkit.Chem import AllChem
      except ModuleNotFoundError:
          raise ImportError(
              "This function requires RDKit to be installed."
          )
  
      # Compute fingerprints for all molecules.
  
      mols = [Chem.MolFromSmiles(smiles) for smiles in dataset.ids]
      fps = [
          AllChem.GetMorganFingerprintAsBitVect(x, 2, 1024)
          for x in mols
      ]
  
      # Split into two groups: training set and everything else.
  
      train_size = int(frac_train * len(dataset))
      valid_size = int(frac_valid * len(dataset))
      test_size = len(dataset) - train_size - valid_size
      train_inds, test_valid_inds = _split_fingerprints(
          fps, train_size, valid_size + test_size
      )
  
      # Split the second group into validation and test sets.
  
      if valid_size == 0 or frac_valid == 0:
          valid_inds = []
          test_inds = test_valid_inds
      elif test_size == 0 or frac_test == 0:
          test_inds = []
          valid_inds = test_valid_inds
      else:
          test_valid_fps = [fps[i] for i in test_valid_inds]
          test_inds, valid_inds = _split_fingerprints(
              test_valid_fps, test_size, valid_size
          )
          test_inds = [test_valid_inds[i] for i in test_inds]
          valid_inds = [test_valid_inds[i] for i in valid_inds]
      return train_inds, valid_inds, test_inds
  
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 2 for calling the FingerprintSplitter obj's underlying member method code with example usage: obj.split(dataset, frac_train, frac_valid, frac_test, seed, log_every_n) and returns: train_inds,  valid_inds,  test_inds