parameters: (data, **args)
return_statement: return data.__class__(data, patterns = patterns)
docstring: return a bootstrap sample from a dataset
  
      :Parameters:
        - `data` - a dataset object
  
      :Keywords:
        - `stratified` - whether to perform stratified bootstrapping, i.e. whether to 
          keep the class ratio
        - `seed` - random number generator seed
docstring_summary: return a bootstrap sample from a dataset
docstring_tokens: return a bootstrap sample from a dataset
function: def bootstrap(data, **args) :
      """
      return a bootstrap sample from a dataset
  
      :Parameters:
        - `data` - a dataset object
  
      :Keywords:
        - `stratified` - whether to perform stratified bootstrapping, i.e. whether to 
          keep the class ratio
        - `seed` - random number generator seed
      """
  
      if 'seed' in args :
          seed = args['seed']
          rand = random.Random(seed)
      else :
          rand = random.Random()
      stratified = True
      if 'stratified' in args :
          stratified = args['stratified']
      if not data.labels.isLabeled() :
          stratified = False
  
      if not stratified :
          patterns = [rand.randint(0, len(data) - 1) for i in range(len(data))]
      else :
          patterns = []
          for c in range(len(data.labels.classLabels)) :
              classSize = len(data.labels.classes[c])
              patterns.extend([data.labels.classes[c][rand.randint(0, classSize - 1)]
                               for i in range(classSize)])
  
      patterns.sort()
      return data.__class__(data, patterns = patterns)
function_tokens: def bootstrap ( data , * * args ) : if 'seed' in args : seed = args [ 'seed' ] rand = random . Random ( seed ) else : rand = random . Random ( ) stratified = True if 'stratified' in args : stratified = args [ 'stratified' ] if not data . labels . isLabeled ( ) : stratified = False if not stratified : patterns = [ rand . randint ( 0 , len ( data ) - 1 ) for i in range ( len ( data ) ) ] else : patterns = [ ] for c in range ( len ( data . labels . classLabels ) ) : classSize = len ( data . labels . classes [ c ] ) patterns . extend ( [ data . labels . classes [ c ] [ rand . randint ( 0 , classSize - 1 ) ] for i in range ( classSize ) ] ) patterns . sort ( ) return data . __class__ ( data , patterns = patterns )