# Posted By

atr000 on 08/14/09

# Statistics

Viewed 382 times
Favorited by 0 user(s)

# python lambda example

/ Published in: Python
Save to your folder(s)

from activestate. not complete or tested but good ref

Copy this code and paste it in your HTML
`if bootstraps == 1:  srri = lambda low, high, size: range(size) else:  srri = scipy.random.random_integers for boot in range(bootstraps):        for r in range(n1):    for c in range(n0):      sample_size = trial_result[r][c].size      choices = srri(0, sample_size-1, sample_size)      meas_grid[r,c] = pylab.array(trial_result[r][c][choices],dtype=float).mean()   model_grid[:,:,:,boot], params[:,boot] = \              process_grid(s0, s1, meas_grid) #Instead ofsrri = scipy.random.random_integersif bootstraps == 1: for r in range(n1):   for c in range(n0):     meas_grid[r,c] = pylab.array(trial_result[r][c],dtype=float).mean()  model_grid[:,:,:,boot], params[:,boot] = \              process_grid(s0, s1, meas_grid)else: for boot in range(bootstraps):   for r in range(n1):     for c in range(n0):       sample_size = trial_result[r][c].size       choices = srri(0, sample_size-1, sample_size)       meas_grid[r,c] = pylab.array(trial_result[r][c][choices],dtype=float).mean()    model_grid[:,:,:,boot], params[:,boot] = \              process_grid(s0, s1, meas_grid) #ORsrri = scipy.random.random_integersfor boot in range(bootstraps):  if bootstraps == 1:   for r in range(n1):     for c in range(n0):       meas_grid[r,c] = pylab.array(trial_result[r][c],dtype=float).mean()     model_grid[:,:,:,boot], params[:,boot] = \              process_grid(s0, s1, meas_grid)  else:   for r in range(n1):     for c in range(n0):       sample_size = trial_result[r][c].size       choices = srri(0, sample_size-1, sample_size)       meas_grid[r,c] = pylab.array(trial_result[r][c][choices],dtype=float).mean()    model_grid[:,:,:,boot], params[:,boot] = \              process_grid(s0, s1, meas_grid)`