Advertisement
Guest User

Untitled

a guest
Mar 1st, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. def simulate_election(model, nsim):
  2. sim = np.random.uniform(size =(51, nsim))
  3. greter = (sim < model.Obama.reshape(-1,1)).astype(float) * model.Votes.reshape(-1,1)
  4. return greter.sum(axis =0)
  5.  
  6. result = simulate_election(predictwise, 10000)
  7. print result
  8. output : array([ 314., 303., 313., ..., 316., 302., 284.])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement