code: def split(activeList, decoyList, options):
      
  
      # set input variables
      training_fraction = options.training_fraction
      decoy_to_active = options.decoy_to_active
  
      # take care of default decoy_to_active ratio
      if decoy_to_active is None:
          decoy_to_active = len(decoyList) / len(activeList)
  
      # verify that there are enough molecules to satisfy the ratio
      if len(decoyList) < (len(activeList) * decoy_to_active):
          max = len(decoyList) / len(activeList)
          print("\n The maximum decoy to active ratio the input file will support is {f} \n".format(f=max))
          sys.exit(1)
  
      # randomly split the actives
      trainsize = int(round(training_fraction * len(activeList)))
  
      trainIndex = []
      valIndex = []
      trainIndex = random.sample(range(len(activeList)), trainsize)
      valIndex = [x for x in range(len(activeList)) if x not in trainIndex]
  
      trainactives = [activeList[index] for index in trainIndex]
      valactives = [activeList[index] for index in valIndex]
  
      # match up decoys
      trainsize = len(trainactives) * decoy_to_active
      valsize = len(valactives) * decoy_to_active
  
      trainIndex = []
      valIndex = []
      trainIndex = random.sample(range(len(decoyList)), int(trainsize))
      valIndex = [x for x in range(len(decoyList)) if x not in trainIndex][0:int(valsize)]
  
      traindecoys = [decoyList[index] for index in trainIndex]
      valdecoys = [decoyList[index] for index in valIndex]
  
      # merge actives and decoys for each set
      trainset = trainactives + traindecoys
      valset = valactives + valdecoys
  
      # return sets
      return trainset, valset
docs: Create training and validation sets