Multivariate Bayesian variable selection regression

M&M model VEM updates

In [1]:
dat = readRDS('/home/gaow/Documents/GTExV8/Thyroid.Lung.FMO2.filled.rds')
attach(dat)
In [2]:
%get X Y --from R
Y = Y.as_matrix()
Loading required package: feather
In [3]:
from libgaow.regression_data import MNMASH
import numpy as np
In [4]:
model = MNMASH(X=X,Y=Y)
In [5]:
model.set_prior({'identity': np.identity(2), 
                 'single_1': np.array([[1,0],[0,0]]), 
                 'single_2': np.array([[0,0], [0,1]]), 
                 'all_in': np.ones((2,2))}, 
                [0.5,1], 
                [0.9,0.01,0.01,0.01,0.01,0.01,0.01,0.02,0.02])
In [ ]:
model.fit(niter=2)
In [7]:
model.post_mean_mat
Out[7]:
array([[ -2.32382184e-19,  -1.36836333e-19],
       [ -3.04885813e-17,  -6.02915572e-17],
       [ -3.02330316e-18,  -3.35486223e-17],
       ..., 
       [  3.44738982e-19,   1.68615485e-18],
       [ -2.70497565e-19,  -1.08394346e-19],
       [  3.88702714e-19,   2.04068922e-18]])
In [9]:
import seaborn as sns
import matplotlib.pyplot as plt
plt.scatter([x+1 for x in range(len(model.post_mean_mat[:,0]))], model.post_mean_mat[:,0], cmap="viridis")
ax = plt.gca()
plt.show()
In [10]:
import seaborn as sns
import matplotlib.pyplot as plt
plt.scatter([x+1 for x in range(len(model.post_mean_mat[:,1]))], model.post_mean_mat[:,1], cmap="viridis")
ax = plt.gca()
plt.show()

Debug previews

In [11]:
model.mash.B
Out[11]:
array([[-0.02767384, -0.06585172],
       [-0.08742572,  0.00192239],
       [-0.03943936, -0.01741381],
       ..., 
       [ 0.01151077, -0.00210548],
       [-0.03341688,  0.07328577],
       [ 0.01482872,  0.0044251 ]])
In [34]:
model.mash.S
Out[34]:
array([[ nan,  nan],
       [ nan,  nan],
       [ nan,  nan],
       ..., 
       [ nan,  nan],
       [ nan,  nan],
       [ nan,  nan]])
In [8]:
print(model)
{   'Xr0': array([[ 0.09902838,  0.04492896],
       [ 0.09905334,  0.04493302],
       [-0.1277729 , -0.15765855],
       ..., 
       [-0.12777212, -0.15765836],
       [ 0.09902838,  0.04492896],
       [ 0.09902716,  0.04492899]]),
    'Y': array([[  1.60689480e-01,   7.73609574e-01],
       [  4.33098395e-01,   7.81487761e-01],
       [ -2.15164667e-01,  -6.50111523e-01],
       ..., 
       [  6.17574628e-01,   2.16840434e-18],
       [  3.03576608e-18,  -5.08905465e-02],
       [ -1.49299907e-01,   3.02853264e-01]]),
    'alpha0': array([[  5.45933365e-017,   1.32758321e-016,   1.89175534e-016, ...,
          6.77746859e-017,   5.29789647e-017,   7.05860121e-017],
       [  2.69163809e-015,   1.71270360e-014,   9.11265900e-015, ...,
          3.79612830e-015,   2.45367078e-015,   3.70535731e-015],
       [  2.22321669e-309,   1.55446248e-309,   8.98221633e-310, ...,
          8.14181125e-310,   1.30153690e-308,   8.28879486e-310],
       [  1.02446086e-171,   6.92914413e-172,   4.20738967e-172, ...,
          3.62439472e-172,   3.95327136e-171,   3.64987152e-172],
       [  3.17571377e-152,   2.13684984e-152,   1.31182971e-152, ...,
          1.11232803e-152,   1.17154032e-151,   1.12196194e-152]]),
    'elbo': [],
    'iter_id': 2,
    'mash': {   'B': array([[-0.02767384, -0.06585172],
       [-0.08742572,  0.00192239],
       [-0.03943936, -0.01741381],
       ..., 
       [ 0.01151077, -0.00210548],
       [-0.03341688,  0.07328577],
       [ 0.01482872,  0.0044251 ]]),
                'S': array([[ 0.03802662,  0.03427535],
       [ 0.0682581 ,  0.0617366 ],
       [ 0.05373473,  0.04855798],
       ..., 
       [ 0.05520583,  0.04987416],
       [ 0.02957212,  0.02659511],
       [ 0.05496787,  0.04966   ]]),
                'U': {   'all_in.1': array([[ 0.25,  0.25],
       [ 0.25,  0.25]]),
                         'all_in.2': array([[ 1.,  1.],
       [ 1.,  1.]]),
                         'identity.1': array([[ 0.25,  0.  ],
       [ 0.  ,  0.25]]),
                         'identity.2': array([[ 1.,  0.],
       [ 0.,  1.]]),
                         'null': array([[ 0.,  0.],
       [ 0.,  0.]]),
                         'single_1.1': array([[ 0.25,  0.  ],
       [ 0.  ,  0.  ]]),
                         'single_1.2': array([[ 1.,  0.],
       [ 0.,  0.]]),
                         'single_2.1': array([[ 0.  ,  0.  ],
       [ 0.  ,  0.25]]),
                         'single_2.2': array([[ 0.,  0.],
       [ 0.,  1.]])},
                'V': array([[ 1.        ,  0.09728834],
       [ 0.09728834,  1.        ]]),
                'X': array([[ 0.66232029, -0.08595989, -0.12194938, ..., -0.1364837 ,
         0.44764338, -0.13791952],
       [-0.33767971, -0.08595989, -0.12194938, ..., -0.1364837 ,
         0.44764338, -0.13791952],
       [-0.33767971,  0.91404011, -0.12194938, ..., -0.1364837 ,
         0.44764338, -0.13791952],
       ..., 
       [-0.33767971, -0.08595989, -0.12194938, ..., -0.1364837 ,
        -0.55235662, -0.13791952],
       [-0.33767971, -0.08595989, -0.12194938, ..., -0.1364837 ,
         0.44764338, -0.13791952],
       [-0.33767971, -0.08595989, -0.12194938, ..., -0.1364837 ,
         0.44764338, -0.13791952]]),
                'Y': array([[ 0.06164614,  0.74777545],
       [ 0.33403009,  0.75564958],
       [-0.08740673, -0.47335813],
       ..., 
       [ 0.74533178,  0.1767532 ],
       [-0.09904334, -0.07672467],
       [-0.24834202,  0.27701911]]),
                'Z': None,
                '_is_common_cov': False,
                'grid': [0.5, 1],
                'l10bf': array([-0.7934147 , -0.96548204, -1.17737859, ..., -1.24902317,
       -0.22649881, -1.24527793]),
                'lik': {   'alt_loglik': array([ 0.98951102,  0.58062815,  1.09356474, ...,  1.16212554,
        0.00991958,  1.16469863]),
                           'lfactor': array([ 2.81641587,  2.80373271,  3.80457912, ...,  4.03810768,
        1.72474613,  4.03205702]),
                           'loglik': 10468.735437149146,
                           'marginal_loglik': array([ 2.72877639,  2.71033068,  3.70657695, ...,  3.93898994,
        0.48996451,  3.93299318]),
                           'null_loglik': array([ 2.81641587,  2.80373271,  3.80457912, ...,  4.03810768,
        0.53145236,  4.03205702]),
                           'relative_likelihood': array([[ 1.        ,  0.03750137,  0.00948399, ...,  0.19162327,
         0.28587933,  0.14360527],
       [ 1.        ,  0.03736103,  0.00956503, ...,  0.06208076,
         0.12988375,  0.06530318],
       [ 1.        ,  0.01397801,  0.00353161, ...,  0.05031885,
         0.09742175,  0.04886843],
       ..., 
       [ 1.        ,  0.01109823,  0.00279809, ...,  0.04967414,
         0.07767785,  0.0389271 ],
       [ 0.30322088,  0.11164543,  0.02825018, ...,  0.50488899,
         0.02786012,  0.01395332],
       [ 1.        ,  0.01116438,  0.002815  , ...,  0.0494625 ,
         0.07907928,  0.03963256]])},
                'neg_prob_mat': array([[ 0.00823421,  0.00888351,  0.00433873, ...,  0.00189991,
         0.00910786,  0.00182953],
       [ 0.01476349,  0.00653534,  0.00484051, ...,  0.00063262,
         0.04420548,  0.00050521]]),
                'pi': array([ 0.9 ,  0.01,  0.01,  0.01,  0.01,  0.01,  0.01,  0.02,  0.02]),
                'post_mean2_mat': array([[  2.39306787e-05,   1.23016555e-04,   2.56463989e-05, ...,
          1.49876851e-05,   2.43208233e-05,   1.54335211e-05],
       [  8.64108730e-06,   9.43156561e-04,   3.07749605e-03, ...,
          1.57969677e-04,   3.49071155e-05,   2.80215605e-04]]),
                'post_mean_mat': array([[ -2.69293411e-04,  -8.70337466e-04,  -2.23409015e-04, ...,
          5.52310537e-05,  -3.89965362e-04,   6.94710584e-05],
       [ -2.77021149e-04,  -1.49338126e-03,  -1.97428939e-03, ...,
          4.29748021e-04,   1.91703541e-04,   5.80250853e-04]]),
                'posterior_weights': array([[  9.82435061e-01,   9.88112735e-01,   9.92668662e-01, ...,
          9.93776666e-01,   9.38124442e-01,   9.93723104e-01],
       [  4.09362898e-04,   4.10187843e-04,   1.54172533e-04, ...,
          1.22546287e-04,   3.83795424e-03,   1.23270019e-04],
       [  1.03526701e-04,   1.05014732e-04,   3.89524091e-05, ...,
          3.08964546e-05,   9.71136134e-04,   3.10814382e-05],
       ..., 
       [  2.09174906e-03,   6.81586522e-04,   5.54999372e-04, ...,
          5.48500018e-04,   1.73562040e-02,   5.46133621e-04],
       [  6.24128611e-03,   2.85199523e-03,   2.14905606e-03, ...,
          1.71543181e-03,   1.91545468e-03,   1.74628680e-03],
       [  3.13517457e-03,   1.43393109e-03,   1.07800347e-03, ...,
          8.59663162e-04,   9.59326433e-04,   8.75195238e-04]]),
                'trace_XXt': array([ 1285.74755823,  1645.74964547,  1474.99961843,  2431.86362943,
        1573.93731825,  1985.63229086,  1722.71676782,  1196.84535627,
        1559.24047364,  1812.54137461,  1500.25358956,  1529.93503045,
        1641.61359624,  2421.81707409,  2502.98070591,  1466.36477889,
        1311.17800224,  1837.40058792,  1280.98808451,  2296.5313088 ,
        1823.03440129,  1445.79597251,  1276.6574532 ,  2569.52069451,
        1801.6875249 ,  1918.92567644,  1119.48568772,  1474.59360472,
        3182.36441038,  1408.49110789,  1633.08604459,  2947.11992813,
        1780.1795657 ,  1302.39633762,  2558.04266555,  2003.74278014,
        1271.42831883,  1673.44238122,  1837.38071938,  1431.0667699 ,
        2339.45352904,  1165.52710149,  1406.25637819,  1868.34089425,
        1404.48221363,  1751.18786087,  2792.14230641,  1807.84155469,
        2041.3750185 ,  1994.74518213,  1107.19345517,  1695.42506499,
        1164.7488248 ,  1282.14399214,  2047.79815298,  1663.86864624,
        1750.3086855 ,  1816.51723114,  2170.27397904,  1232.73886654,
        1929.79120324,  1880.64275364,  1600.76903406,  1314.8514994 ,
        1632.18177111,  1778.8608687 ,  1616.97077214,  2360.83005899,
        1141.70381475,  2271.79282434,  1090.42953396,  1880.75447003,
        2577.19383685,  1224.56201251,  2598.37454117,  1721.93015083,
        2054.48789652,  2235.24321359,  1680.05146321,  1976.93371624,
        1199.14600521,  1194.28547062,  1587.27532756,  1984.10486544,
        1222.58017461,  1820.50865992,  1547.92961685,  1479.869659  ,
        1579.77919589,  1244.69126434,  2102.29297498,  1446.81480073,
        1575.27606396,  1471.53731059,  2077.5616407 ,  1876.14991829,
        1354.7084005 ,  3180.6329562 ,  2168.20829481,  1577.53896897,
        1882.14825524,  1543.68836035,  2520.48587556,  2048.56379258,
        1827.51752575,  2329.135439  ,  2120.98914721,  2010.35685292,
        1505.68978621,  1832.84672355,  2472.16332511,  1251.68095142,
        1876.3534272 ,  1488.53413204,  1894.88258687,  1523.21255155,
        1780.98148671,  2049.15798936,  1074.5042261 ,  2860.31880214,
        1108.15890472,  1621.11428101,  1867.24206569,  1351.29065262,
         980.16687775,  1736.09243627,  2028.68498729,  1717.28924331,
        1753.61364016,  1287.96865884,  1854.74781003,  1666.40548762,
        1772.65125925,  2046.64984723,  1551.85241594,  1495.22523802,
        1856.67669612,  1679.03499347,  1784.42829523,  1165.74943211,
        1335.89073313,  2030.78624698,  1449.63182155,  1797.26083305,
        1870.59500025,  1659.29782134,  1336.86171951,  1880.54451749,
        1489.69862907,  1687.88816593,  1778.22288543,  2979.13384148,
        2219.60290816,  1542.66566184,  1849.72757782,  1354.08709788,
        2425.79175125,  1809.26903606,  1917.89524961,  2582.26759531,
        1490.52294777,  2259.98591129,  1710.86798463,  1397.69194794,
        2126.20256525,  1798.07416528,  1228.0244146 ,  1905.99427739,
        1830.89934154,  1971.81605122,  1600.53784614,  1901.06211847,
        2401.94992547,  1692.5492925 ,  1536.97089501,  1950.93857886,
        1771.6805314 ,  1851.75209132,  1673.21627294,  1599.00456835,
        2086.64891509,  2226.90433371,  1726.1777312 ,  1429.99201969,
        1908.82334272,  1667.57200967,  1702.6385838 ,  1581.50122461,
        2222.89076898,  1961.02175227,  1503.74992144,  1618.93206865,
        1935.34352829,  1852.37492737,  1228.83133337,  1986.04026193,
        1624.10064149,  2166.02944942,  2215.22786373,  2589.35496902,
        1548.29904467,  2263.3811615 ,  1652.95356814,  1480.98945128,
        1955.42271738,  1760.44219279,  1383.8748652 ,  1516.14480627,
        1757.98039188,  1894.58291006,  1716.44178485,  1461.71367391,
        1262.59870108,  1709.54977117,  1450.98949016,  1618.65626898,
        2259.0100011 ,  2139.12764895,  2451.27137701,  1287.91714163,
        2071.45640174,  1721.90445093,  1257.27131608,  1434.54156191,
        2134.77702028,  1698.03396031,  2687.41501611,  1582.43774926,
        1421.3214198 ,  2253.2854731 ,  2953.40175672,  1888.40775033,
        1402.75303916,  2170.40856114,  1288.41248976,  1792.24535534,
        1619.2213481 ,  1165.29208635,  1961.2511168 ,  2576.69992737,
        2383.62252091,  1586.27950291,  1288.62594599,  1651.12593724,
        1865.91343249,  2632.74903021,  1466.92435296,  1661.76311691,
        1614.29350153,  1247.95394424,  1499.80288593,  1818.90200185,
        1616.17424872,  1872.49310273,  2029.87896568,  2218.82876974,
        1090.56365103,  2131.75165388,  1981.89858884,  2337.28027807,
        1708.39361387,  1710.2821638 ,  1891.70007959,  1712.11355999,
        1868.93488502,  1246.53354702,  1457.25226147,  2175.55219982,
        1940.68228718,  1530.17149549,  1800.3476233 ,  1815.01461078,
        1319.9532181 ,  1455.00614774,  1780.135671  ,  2222.69679251,
        2310.16023406,  1581.92564572,  1127.96808531,  1446.59031784,
        1750.48757584,  1267.12427304,  1365.74965487,  1576.72264069,
        2037.00051009,  1741.00179606,  2089.34171006,  1221.35096033,
        3007.68112368,  2174.50319163,  1421.38332119,  1471.84749033,
        2270.88298121,  2105.95088206,  1222.01742853,  1297.67548758,
         996.47853645,  1803.19306973,  1428.9528776 ,  2051.2396076 ,
        1500.33635009,  2367.34069654,  1261.72969904,  1631.88117872,
        2153.35033111,  1061.44667036,  1278.55436911,  2222.98977316,
        1656.56439865,  1138.87174109,  2749.99265946,  1282.23922794,
        2089.0355149 ,  2137.17633761,  1340.68909187,  1786.81207285,
        1337.70993155,  1427.52148213,  1476.73860896,  1449.50748773,
        2170.02782887,  1795.70239075,  2021.10542433,  1895.34146167,
        1275.08074997,  1392.34628739,  1668.01708356,  1695.83133968,
        1547.01733046,  1779.83853728,  1881.51380317,  1432.97144617,
        1083.84896859,  2042.70842077,  1586.96708022,  1724.01518957,
        2393.66448239,  2139.16015292,  1919.46022539,  1692.96477627,
        1568.84406209,  1170.97478071,  2231.14919726,  1607.58877398,
        1976.50408074,  1329.54698861,  1165.24089492,  1719.27936168,
        1870.65543025,  2082.54956485,  1767.28140209,  2027.79550976,
        1581.95668379,  1576.22729322,  1912.12977045,  1727.14181351,
        1906.29896751,  1460.25776999,  1968.33739437,  1479.79013701,
        1723.85799538,  1878.84347833,  1823.93810996,  1964.67051034,
        1577.16042339,  2027.21205143,  1960.49829546,  1745.82275172,
        2273.94379945,  1308.35760164,  2704.607246  ,  1999.26006729,
        2060.21937435,  1573.34086242,  2130.9254276 ,  1688.98635608,
        1280.25528863,  1552.37643851,  1509.65780429,  1756.43548393,
        1680.75004299,  2089.32546131,  1808.86458918,  2221.90486917,
        1284.85037995,  1326.08884812,  2104.63675071,  1623.78935009,
        1383.69761097,  1662.24233841,  2319.37917338,  2051.823454  ,
        1763.78030232,  1062.82273609,  1139.07298837,  2264.87750034,
        1651.56673381,  2133.39398325,  1659.35256755,  1453.10988452,
        1316.05963324,  1895.11444276,  1655.37104284,  2175.32235811,
        1515.22606298,  2757.8617471 ,  1781.83697221,  1502.61395545,
        2213.59209845,  1602.10979231,  2546.42552565,  2110.9557598 ,
        2046.0810098 ,  1702.66509563,  1934.18421471,  1715.99037373,
        1262.6850038 ,  1724.67395604,  1498.5637194 ,  1510.37342723,
        1641.14021919,  3077.64927317,  1279.61084888,  1820.26179225,
        1792.42239711,  1925.99235023,  1363.1074914 ,  1608.75135895,
        2219.79118552,  1933.26759567,  1379.44146001,  2125.13115317,
        1735.40373488,  1466.06994584,  1937.00462103,  1517.00077582,
        1753.47643184,  1271.33010334,  2087.11467041,  1783.02891271,
        1847.1938205 ,  1853.36220511,  1708.66793599,  1628.52849681,
        1813.06977372,  1925.78442635,  1582.76486923,  1768.01516728,
        1227.24964394,  1285.43945145,  2008.04997476,  1913.79687334,
        1716.83565044,  1385.33903232,  1294.80934815,  1692.15155153,
        1937.85777001,  1893.67208591,  1873.16586457,  2438.94654087,
        1778.47693373,  2283.05938635,  1780.14912259,  2092.53721615,
        2022.44759638,  1607.02846195,  2136.85996526,  2228.82487455,
        1490.3321924 ,  1231.41771403,  1060.08760193,  2505.80933758,
        2174.95580707,  1711.78849927,  2959.46689646,  1878.14831438,
        2272.88900263,  2137.5432506 ,  1409.98548167,  2819.0300547 ,
        1673.89422018,  1542.50156279,  1653.33924711,  1698.1670182 ,
        1668.88503967,  1761.69523583,  1498.27940222,  1349.33674986,
        1893.27703749,  1827.21332248,  1126.03308085,  2093.59587377,
        1336.20438621,  1600.90097887,  1265.8223054 ,  1685.78861116,
        1684.23437005,  1433.34944604,  1545.17620487,  1824.62130741,
        1901.70624434,  1577.77314478,  1277.63595909,  2083.278325  ,
        2040.30254126,  1060.43430105,  1488.48889656,  1453.48652563,
        1144.7684432 ,  1740.4405586 ,  1917.61920168,  2077.70171515,
        1359.67055475,  1640.13714215,  1451.73565304,  1360.74353502,
        1391.6637903 ,  1365.67859571,  1443.16902443,  2092.09429581,
        1462.63779656,  2182.3830016 ,  1584.4420074 ,  1979.1612867 ,
        1860.44440846,  1921.84302764,  2155.05430968,  1659.24191012,
        1269.24115874,  2060.73424094,  2574.83795033,  2548.06939391,
        1226.25746284,  1724.11828114,  1596.88899576,  1844.00553416,
        2078.49144423,  1765.99744996,  2264.02407678,  1419.35515037,
        1776.88373638,  1628.97284853,  1614.14839518,  1986.83732036,
        1437.93798741,  1343.98164477,  1889.81143605,  1394.20297264,
        1167.89362759,  1556.88361156,  1770.54756355,  1995.42516744,
        1809.01616904,  1315.38453508,  2578.85084327,  1889.25872354,
        1306.22177432,  2380.48915491,  1365.85761828,  2149.95563042,
        1653.91441811,  1733.2956507 ,  1459.78753131,  1486.84586102,
        2003.37293015,  2084.77564708,  2638.89469655,  1585.24054182,
        1624.85227054,  1569.23770603,  1360.57351921,  1365.24837917,
        3175.51805951,  1710.51581824,  1600.45591997,  1337.66271675,
        1474.16344088,  1560.7587983 ,  1830.15966399,  1483.36454525,
        1151.40304048,  1852.80650561,  1447.11177489,  2142.37680734,
        1876.53387498,  1921.82739841,  1597.32795465,  1807.79066839,
        1807.44686878,  1560.47093778,  1655.77326384,  1688.12285863,
        1571.04021997,  2481.97460006,  1464.86960377,  1666.86310585,
        1749.0044958 ,  1509.74895576,  1676.93305953,  1442.89021285,
        1360.04116783,  1715.31858826,  1312.80658248,  1475.06186649,
        1344.95992985,  1430.20770055,  1104.8839583 ,  2734.27226154,
        1573.66317959,  1277.71758345,  1335.83007779,  1388.9561474 ,
        1300.21639275,  2051.70360448,  2030.46555767,  1552.73702999,
        1904.32138669,  2086.02641062,  1390.44217529,  1848.11667207,
        1948.53071236,  1722.30306049,  1665.22319103,  1839.24052821,
        3506.50015831,  2499.587074  ,  2004.30138752,  2593.24765943,
        1555.62340477,  3127.05792883,  2078.43826105,  1521.86226946,
        1884.20897122,  1985.42702119,  1858.6670123 ,  1489.39470748,
        2012.23146471,  1752.293432  ,  1931.76795821,  1207.12045482,
        2050.21345444,  1903.98738195,  2017.90770096,  1592.90254654,
        1135.37919832,  1751.99801803,  1891.66212847,  1581.44965142,
        1758.30413559,  2013.54473369,  2644.57459095,  1501.71620824,
        1435.28018764,  1397.56391215,  1507.66198833,  1345.80092816,
        2106.59321081,  1457.03221165,  1719.15477915,  1197.31458789,
        1830.48941053,  1594.11199994,  1431.08603553,  1621.10001645,
        2063.26021581,  3146.42859182,  2578.17393432,  2218.42350389,
        1494.07773519,  2429.83431774,  2069.09548515,  1829.38368409,
        2160.14143159,  2056.7431172 ,  1578.48562599,  2152.37262937,
        2046.87922352,  2214.33113537,  2247.61466536,  1573.46427022,
        1297.56212325,  2202.69071816,  3384.09956651,  1787.83456528,
        1818.90310555,  1195.18379937,  1894.51793372,  2555.79038553,
        2297.52516797,  1447.54704907,  2031.94968376,  1125.15426718,
        1592.83454948,  1652.03605506,  1937.06272432,  1579.71531201,
        1397.32763121,  1674.12473403]),
                'x_centered': True,
                'y_centered': True,
                'z_centered': False,
                'zero_prob_mat': array([[ 0.98867805,  0.99014968,  0.99432948, ...,  0.99541813,
         0.98985692,  0.99535752],
       [ 0.98386766,  0.99316192,  0.994919  , ...,  0.99563   ,
         0.94058365,  0.99558975]])},
    'mu0': array([[[ -1.39197867e-04,  -8.54325569e-05],
        [ -4.26502931e-04,  -1.10794709e-03],
        [ -3.58714775e-04,  -4.85011436e-03],
        ..., 
        [  2.58961565e-04,   1.18478475e-03],
        [ -6.49469076e-06,  -2.53193515e-06],
        [  2.90978181e-04,   1.32773314e-03]],

       [[ -8.35115644e-05,  -4.91047758e-05],
        [ -1.77683748e-03,  -3.51166823e-03],
        [ -3.24322802e-04,  -3.58085377e-03],
        ..., 
        [  8.61899065e-05,   4.23024806e-04],
        [ -1.10101764e-04,  -4.41217329e-05],
        [  9.93598440e-05,   5.25447257e-04]],

       [[ -2.40596333e-04,  -3.00815981e-04],
        [ -9.63229461e-04,  -2.37319068e-03],
        [ -2.37511528e-04,  -2.93260676e-03],
        ..., 
        [  5.66656544e-05,   6.76872108e-04],
        [ -4.77825176e-04,   6.01048442e-04],
        [  7.20482091e-05,   9.26485644e-04]],

       [[ -2.69634190e-04,  -2.80914307e-04],
        [ -8.64482000e-04,  -1.54874228e-03],
        [ -2.21927582e-04,  -2.03979944e-03],
        ..., 
        [  5.50013709e-05,   4.48409466e-04],
        [ -3.93143717e-04,   2.24807523e-04],
        [  6.94340890e-05,   6.05632166e-04]],

       [[ -2.69293411e-04,  -2.77021149e-04],
        [ -8.70337466e-04,  -1.49338126e-03],
        [ -2.23409015e-04,  -1.97428939e-03],
        ..., 
        [  5.52310537e-05,   4.29748021e-04],
        [ -3.89965362e-04,   1.91703541e-04],
        [  6.94710584e-05,   5.80250853e-04]]]),
    'post_mean_mat': array([[ -2.32382184e-19,  -1.36836333e-19],
       [ -3.04885813e-17,  -6.02915572e-17],
       [ -3.02330316e-18,  -3.35486223e-17],
       ..., 
       [  3.44738982e-19,   1.68615485e-18],
       [ -2.70497565e-19,  -1.08394346e-19],
       [  3.88702714e-19,   2.04068922e-18]])}
In [7]:
model.mash.X @ (np.vstack(model.alpha0[4,:]) * model.mu0[4,:,:])
Out[7]:
array([[ 0.00141929,  0.00349287],
       [-0.00089172,  0.00162742],
       [-0.00116825,  0.00088264],
       ..., 
       [-0.00049898,  0.00130733],
       [ 0.00147354,  0.0035191 ],
       [-0.00060989,  0.00060893]])
In [13]:
(model.alpha0[2,:] == model.alpha0[4,:]).all()
Out[13]:
True
In [9]:
(model.mu0[4,:,:] == model.mu0[4,:,:]).all()
Out[9]:
True
In [11]:
(np.vstack(model.alpha0[4,:]) * model.mu0[4,:,:])
Out[11]:
array([[ -7.89963793e-09,  -5.20032243e-09],
       [ -9.65163534e-08,  -2.28080366e-07],
       [ -2.87999221e-08,  -6.00510760e-07],
       ..., 
       [  1.11552458e-08,   7.98473138e-08],
       [ -4.28912388e-09,  -2.21049054e-09],
       [  1.22126119e-08,   9.02205960e-08]])
In [7]:
lala = np.exp((model.mash.l10bf - np.max(model.mash.l10bf)) * np.log(10))
/home/gaow/Public/miniconda3/lib/python3.6/site-packages/ipykernel_launcher.py:1: RuntimeWarning: invalid value encountered in subtract
  """Entry point for launching an IPython kernel.
In [7]:
lik = model.mash.lik
np.min(lik['null_loglik'])
Out[7]:
-348.70485097407152
In [9]:
np.max(model.alpha0)
Out[9]:
0.99997864314616747
In [12]:
np.max(lik['alt_loglik'] - lik['null_loglik'])
Out[12]:
345.62420250283145
In [ ]:


Copyright © 2016-2020 Gao Wang et al at Stephens Lab, University of Chicago