def _createDataset(numSequences, originalSequences, relativeFrequencies):
 dataSet = []
 trainingCummulativeFrequencies = numpy.cumsum(relativeFrequencies)
 for _ in xrange(numSequences):
  whichSequence = numpy.searchsorted(trainingCummulativeFrequencies, _RGEN.random_sample())
  dataSet.append(originalSequences[whichSequence])
 return dataSet

def _createDataset ( numSequences , originalSequences , relativeFrequencies ) : dataSet = [ ] trainingCummulativeFrequencies = numpy . cumsum ( relativeFrequencies ) for _ in xrange ( numSequences ) : whichSequence = numpy . searchsorted ( trainingCummulativeFrequencies , _RGEN . random_sample ( ) ) dataSet . append ( originalSequences [ whichSequence ] ) return dataSet
given a set of sequences .