# PyMC3 sampling cannot reach some positive probability combinations no matter how many iterations

Hi,

I know this might be a newbie question, but my PyMC3 discrete Bayesian network model just won’t reach some value combinations of around 6% sum probability.

The network is the “asia” network specified at ( sorry new user can only post 2 links, please google search for bayesian network asia.bif ), all 8 variables are binary, so there are 2^8=256 combinations, of which 128 combinations have positive probability. However, my PyMC3 model sampling up to 500,000 samples only reaches 32 of them, these 32 combinations’ probabilities sum to about 93.5%,

another 96 combinations of about 6.5% summed probability refuse to appear in the sample, no matter how large the sample is. I tried 5K, 50K, 500K, 2M samples. Below is the output of 2M samples.

Attached is my model (in the npy file, it’s actually a gz file renamed as .npy) and a minimal python program to reproduce the situation.
asia.pm3.gz.npy (37.7 KB) pyMC3_validate.py (1.6 KB)

I appreciate your help!

./pyMC3_validate.py
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
Sum of probs: 0.9999999999999999
Positive 128, Zero 128
Multiprocess sampling (4 chains in 4 jobs)
BinaryGibbsMetropolis: [asia, tub, smoke, lung, bronc, either, xray, dysp]
Sampling 4 chains: 100%|█████████| 2002000/2002000 [16:02<00:00, 2079.28draws/s]
Sampled Tuples, count, probability:
(0, 1, 0, 1, 0, 1, 0, 0):230:0.0001026000000000003
(0, 1, 0, 1, 0, 1, 0, 1):55:2.5650000000000068e-05
(0, 1, 0, 1, 0, 1, 1, 0):4208:0.0019494000000000035
(0, 1, 0, 1, 0, 1, 1, 1):1052:0.00048735000000000076
(0, 1, 0, 1, 1, 1, 0, 0):28:8.550000000000013e-06
(0, 1, 0, 1, 1, 1, 0, 1):149:7.695000000000003e-05
(0, 1, 0, 1, 1, 1, 1, 0):347:0.0001624500000000002
(0, 1, 0, 1, 1, 1, 1, 1):3215:0.0014620500000000027
(0, 1, 1, 1, 0, 1, 0, 0)5.64300000000001e-05
(0, 1, 1, 1, 0, 1, 0, 1):35:1.4107500000000022e-05
(0, 1, 1, 1, 0, 1, 1, 0):2297:0.0010721700000000016
(0, 1, 1, 1, 0, 1, 1, 1):563:0.0002680425000000004
(0, 1, 1, 1, 1, 1, 0, 0):24:1.6458750000000036e-05
(0, 1, 1, 1, 1, 1, 0, 1):316:0.00014812875000000018
(0, 1, 1, 1, 1, 1, 1, 0):665:0.0003127162500000006
(0, 1, 1, 1, 1, 1, 1, 1):6121:0.002814446250000005
(1, 1, 0, 1, 0, 1, 0, 0):22671:0.01058508
(1, 1, 0, 1, 0, 1, 0, 1):5545:0.0026462699999999996
(1, 1, 0, 1, 0, 1, 1, 0):429130:0.20111652
(1, 1, 0, 1, 0, 1, 1, 1):107926:0.050279130000000005
(1, 1, 0, 1, 1, 1, 0, 0):1839:0.0008820900000000003
(1, 1, 0, 1, 1, 1, 0, 1):16995:0.007938810000000001
(1, 1, 0, 1, 1, 1, 1, 0):35891:0.016759710000000004
(1, 1, 0, 1, 1, 1, 1, 1):322656:0.15083739
(1, 1, 1, 1, 0, 1, 0, 0):12444:0.005821793999999999
(1, 1, 1, 1, 0, 1, 0, 1):3134:0.0014554484999999995
(1, 1, 1, 1, 0, 1, 1, 0):235787:0.11061408599999996
(1, 1, 1, 1, 0, 1, 1, 1):59309:0.027653521499999997
(1, 1, 1, 1, 1, 1, 0, 0):3715:0.001698023250000002
(1, 1, 1, 1, 1, 1, 0, 1):32389:0.015282209250000013
(1, 1, 1, 1, 1, 1, 1, 0):68762:0.03226244175
(1, 1, 1, 1, 1, 1, 1, 1):622402:0.29036197574999995

Positive probability tuples not in sample:
(0, 0, 0, 0, 0, 0, 0, 0):1.3230000000000005e-05
(0, 0, 0, 0, 0, 0, 0, 1):1.4700000000000022e-06
(0, 0, 0, 0, 0, 0, 1, 0):2.7e-07
(0, 0, 0, 0, 0, 0, 1, 1):2.9999999999999984e-08
(0, 0, 0, 0, 1, 0, 0, 0):6.8600000000000165e-06
(0, 0, 0, 0, 1, 0, 0, 1):2.940000000000005e-06
(0, 0, 0, 0, 1, 0, 1, 0):1.4000000000000027e-07
(0, 0, 0, 0, 1, 0, 1, 1):6.000000000000007e-08
(0, 0, 0, 1, 0, 0, 0, 0):0.00011906999999999992
(0, 0, 0, 1, 0, 0, 0, 1):1.3230000000000005e-05
(0, 0, 0, 1, 0, 0, 1, 0):2.4299999999999975e-06
(0, 0, 0, 1, 0, 0, 1, 1):2.7e-07
(0, 0, 0, 1, 1, 0, 0, 0):6.174000000000007e-05
(0, 0, 0, 1, 1, 0, 0, 1):2.646000000000001e-05
(0, 0, 0, 1, 1, 0, 1, 0):1.260000000000001e-06
(0, 0, 0, 1, 1, 0, 1, 1):5.400000000000001e-07
(0, 0, 1, 0, 0, 0, 0, 0):6.615000000000007e-07
(0, 0, 1, 0, 0, 0, 0, 1):7.350000000000003e-08
(0, 0, 1, 0, 0, 0, 1, 0):1.3500000000000033e-08
(0, 0, 1, 0, 0, 0, 1, 1):1.5e-09
(0, 0, 1, 0, 1, 0, 0, 0):1.2005000000000036e-06
(0, 0, 1, 0, 1, 0, 0, 1):5.145000000000012e-07
(0, 0, 1, 0, 1, 0, 1, 0):2.4500000000000067e-08
(0, 0, 1, 0, 1, 0, 1, 1):1.0500000000000021e-08
(0, 0, 1, 1, 0, 0, 0, 0):6.54885e-05
(0, 0, 1, 1, 0, 0, 0, 1):7.276500000000008e-06
(0, 0, 1, 1, 0, 0, 1, 0):1.3364999999999996e-06
(0, 0, 1, 1, 0, 0, 1, 1):1.4850000000000012e-07
(0, 0, 1, 1, 1, 0, 0, 0):0.00011884950000000002
(0, 0, 1, 1, 1, 0, 0, 1):5.093549999999997e-05
(0, 0, 1, 1, 1, 0, 1, 0):2.4255e-06
(0, 0, 1, 1, 1, 0, 1, 1):1.0394999999999991e-06
(0, 1, 0, 0, 0, 0, 0, 0):0.00025137000000000005
(0, 1, 0, 0, 0, 0, 0, 1):2.7930000000000036e-05
(0, 1, 0, 0, 0, 0, 1, 0):5.129999999999999e-06
(0, 1, 0, 0, 0, 0, 1, 1):5.700000000000006e-07
(0, 1, 0, 0, 1, 0, 0, 0):0.00013034000000000006
(0, 1, 0, 0, 1, 0, 0, 1):5.586000000000008e-05
(0, 1, 0, 0, 1, 0, 1, 0):2.6600000000000004e-06
(0, 1, 0, 0, 1, 0, 1, 1):1.1400000000000014e-06
(0, 1, 1, 0, 0, 0, 0, 0):1.256850000000001e-05
(0, 1, 1, 0, 0, 0, 0, 1):1.3965000000000026e-06
(0, 1, 1, 0, 0, 0, 1, 0):2.565000000000001e-07
(0, 1, 1, 0, 0, 0, 1, 1):2.8500000000000047e-08
(0, 1, 1, 0, 1, 0, 0, 0):2.2809500000000023e-05
(0, 1, 1, 0, 1, 0, 0, 1):9.775500000000003e-06
(0, 1, 1, 0, 1, 0, 1, 0):4.6550000000000035e-07
(0, 1, 1, 0, 1, 0, 1, 1):1.995e-07
(1, 0, 0, 0, 0, 0, 0, 0):0.000261954
(1, 0, 0, 0, 0, 0, 0, 1):2.9106000000000036e-05
(1, 0, 0, 0, 0, 0, 1, 0):5.345999999999999e-06
(1, 0, 0, 0, 0, 0, 1, 1):5.940000000000006e-07
(1, 0, 0, 0, 1, 0, 0, 0):0.00013582800000000003
(1, 0, 0, 0, 1, 0, 0, 1):5.821200000000008e-05
(1, 0, 0, 0, 1, 0, 1, 0):2.772e-06
(1, 0, 0, 0, 1, 0, 1, 1):1.1880000000000012e-06
(1, 0, 0, 1, 0, 0, 0, 0):0.002357586000000004
(1, 0, 0, 1, 0, 0, 0, 1):0.0002619540000000005
(1, 0, 0, 1, 0, 0, 1, 0):4.811400000000002e-05
(1, 0, 0, 1, 0, 0, 1, 1):5.346000000000009e-06
(1, 0, 0, 1, 1, 0, 0, 0):0.001222452000000001
(1, 0, 0, 1, 1, 0, 0, 1):0.0005239080000000006
(1, 0, 0, 1, 1, 0, 1, 0):2.494800000000006e-05
(1, 0, 0, 1, 1, 0, 1, 1):1.0692000000000017e-05
(1, 0, 1, 0, 0, 0, 0, 0):1.3097700000000008e-05
(1, 0, 1, 0, 0, 0, 0, 1):1.4553000000000026e-06
(1, 0, 1, 0, 0, 0, 1, 0):2.673000000000001e-07
(1, 0, 1, 0, 0, 0, 1, 1):2.9700000000000048e-08
(1, 0, 1, 0, 1, 0, 0, 0):2.376990000000002e-05
(1, 0, 1, 0, 1, 0, 0, 1):1.0187100000000003e-05
(1, 0, 1, 0, 1, 0, 1, 0):4.851000000000003e-07
(1, 0, 1, 0, 1, 0, 1, 1):2.0789999999999998e-07
(1, 0, 1, 1, 0, 0, 0, 0):0.0012966723000000019
(1, 0, 1, 1, 0, 0, 0, 1):0.0001440747000000001
(1, 0, 1, 1, 0, 0, 1, 0):2.646270000000003e-05
(1, 0, 1, 1, 0, 0, 1, 1):2.940300000000007e-06
(1, 0, 1, 1, 1, 0, 0, 0):0.002353220100000002
(1, 0, 1, 1, 1, 0, 0, 1):0.001008522900000001
(1, 0, 1, 1, 1, 0, 1, 0):4.802490000000007e-05
(1, 0, 1, 1, 1, 0, 1, 1):2.0582100000000014e-05
(1, 1, 0, 0, 0, 0, 0, 0):0.025933446000000013
(1, 1, 0, 0, 0, 0, 0, 1):0.0028814940000000005
(1, 1, 0, 0, 0, 0, 1, 0):0.0005292540000000008
(1, 1, 0, 0, 0, 0, 1, 1):5.88060000000001e-05
(1, 1, 0, 0, 1, 0, 0, 0):0.013446972000000001
(1, 1, 0, 0, 1, 0, 0, 1):0.005762988000000002
(1, 1, 0, 0, 1, 0, 1, 0):0.0002744280000000002
(1, 1, 0, 0, 1, 0, 1, 1):0.000117612
(1, 1, 1, 0, 0, 0, 0, 0):0.0012966723000000008
(1, 1, 1, 0, 0, 0, 0, 1):0.0001440747000000001
(1, 1, 1, 0, 0, 0, 1, 0):2.6462699999999983e-05
(1, 1, 1, 0, 0, 0, 1, 1):2.9403000000000017e-06
(1, 1, 1, 0, 1, 0, 0, 0):0.0023532200999999997
(1, 1, 1, 0, 1, 0, 0, 1):0.0010085229
(1, 1, 1, 0, 1, 0, 1, 0):4.802490000000007e-05
(1, 1, 1, 0, 1, 0, 1, 1):2.0582100000000014e-05