Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed validation postproc

  • Loading branch information...
commit b882e892c3a489f477c6af283372d955d910e1a1 1 parent 394a648
@apatil apatil authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 mbgw/__init__.py
View
10 mbgw/__init__.py
@@ -150,11 +150,13 @@ def bin_finalize(products, n, bins_list=bins_list, bin_reduce_list=bin_reduce_li
# Postprocessing stuff for validation
-def pr(data):
- obs = data.pos
+def pr(data, a_pred=a_pred, P_trace=P_trace, S_trace=S_trace, F_trace=F_trace):
n = data.pos + data.neg
- def f(sp_sub, two_ten_facs=two_ten_factors):
- return pm.flib.invlogit(sp_sub)*two_ten_facs[np.random.randint(len(two_ten_facs))]
+ obs = data.pos/n.astype('float')
+ facs = agecorr.age_corr_factors(data.lo_age, data.up_age, 10000, a_pred, P_trace, S_trace, F_trace).T
+ def f(sp_sub, facs=facs, n=n):
+ p=pm.flib.invlogit(sp_sub)*facs[np.random.randint(10000)]
+ return np.random.binomial(n,p).astype('float')/n
return obs, n, f
validate_postproc=[pr]
Please sign in to comment.
Something went wrong with that request. Please try again.