plt.imshow(gam_gaus_pp[..., 0], cmap=plt.cm.hot) plt.title('Gamma-Gaussian mixture,\n first component posterior proba.') plt.colorbar() plt.subplot(3, 3, 5) plt.imshow(gam_gaus_pp[..., 1], cmap=plt.cm.hot) plt.title('Gamma-Gaussian mixture,\n second component posterior proba.') plt.colorbar() plt.subplot(3, 3, 6) plt.imshow(gam_gaus_pp[..., 2], cmap=plt.cm.hot) plt.title('Gamma-Gaussian mixture,\n third component posterior proba.') plt.colorbar() ############################################################################### # fit Beta's histogram with a mixture of Gaussians alpha = 0.01 gaus_mix_pp = en.three_classes_GMM_fit(Beta, None, alpha, prior_strength=100) gaus_mix_pp = np.reshape(gaus_mix_pp, (shape[0], shape[1], 3)) plt.figure(fig.number) plt.subplot(3, 3, 7) plt.imshow(gaus_mix_pp[..., 0], cmap=plt.cm.hot) plt.title('Gaussian mixture,\n first component posterior proba.') plt.colorbar() plt.subplot(3, 3, 8) plt.imshow(gaus_mix_pp[..., 1], cmap=plt.cm.hot) plt.title('Gaussian mixture,\n second component posterior proba.') plt.colorbar() plt.subplot(3, 3, 9) plt.imshow(gaus_mix_pp[..., 2], cmap=plt.cm.hot) plt.title('Gamma-Gaussian mixture,\n third component posterior proba.')
# read the functional image rbeta = load(input_image) beta = rbeta.get_data() beta = beta[mask > 0] mf = plt.figure(figsize=(13, 5)) a1 = plt.subplot(1, 3, 1) a2 = plt.subplot(1, 3, 2) a3 = plt.subplot(1, 3, 3) # fit beta's histogram with a Gamma-Gaussian mixture bfm = np.array([2.5, 3.0, 3.5, 4.0, 4.5]) bfp = en.gamma_gaussian_fit(beta, bfm, verbose=1, mpaxes=a1) # fit beta's histogram with a mixture of Gaussians alpha = 0.01 pstrength = 100 bfq = en.three_classes_GMM_fit(beta, bfm, alpha, pstrength, verbose=1, mpaxes=a2) # fit the null mode of beta with the robust method efdr = en.NormalEmpiricalNull(beta) efdr.learn() efdr.plot(bar=0, mpaxes=a3) a1.set_title('Fit of the density with \n a Gamma-Gaussian mixture') a2.set_title('Fit of the density with \n a mixture of Gaussians') a3.set_title('Robust fit of the density \n with a single Gaussian') plt.show()