Exemplo n.º 1
0
 def test_1D_smoothing(self):
     """
     Test :meth:`bet.postProcess.plotP.smooth_marginals_1D`.
     """
     (bins, marginals) = plotP.calculate_1D_marginal_probs(self.P_samples, self.samples, self.lam_domain, nbins=10)
     marginals_smooth = plotP.smooth_marginals_1D(marginals, bins, sigma=10.0)
     nptest.assert_equal(marginals_smooth[0].shape, marginals[0].shape)
     nptest.assert_almost_equal(np.sum(marginals_smooth[0]), 1.0)
Exemplo n.º 2
0
    def test_1D_smoothing(self):
        """
        Test :meth:`bet.postProcess.plotP.smooth_marginals_1D`.
        """
        (bins, marginals) = plotP.calculate_1D_marginal_probs(self.samples,
                                                              nbins = 10)

        marginals_smooth = plotP.smooth_marginals_1D(marginals, bins, sigma = 10.0)

        nptest.assert_equal(marginals_smooth[0].shape,  marginals[0].shape)
        nptest.assert_almost_equal(np.sum(marginals_smooth[0]), 1.0)
Exemplo n.º 3
0
                             file_extension = ".eps", plot_surface=False)

# smooth 2d marginals probs (optional)
marginals2D = plotP.smooth_marginals_2D(marginals2D, bins, sigma=0.1)

# plot 2d marginals probs
plotP.plot_2D_marginal_probs(marginals2D, bins, input_samples,
                             filename = "validation_smooth",
                             file_extension = ".eps", plot_surface=False)

# calculate 1d marginal probs
(bins, marginals1D) = plotP.calculate_1D_marginal_probs(input_samples,
                                                        nbins = [30, 30])

# plot 2d marginal probs
plotP.plot_1D_marginal_probs(marginals1D, bins, input_samples,
                             filename = "validation_raw",
                             file_extension = ".eps")

# smooth 1d marginal probs (optional)
marginals1D = plotP.smooth_marginals_1D(marginals1D, bins, sigma=0.1)

# plot 2d marginal probs
plotP.plot_1D_marginal_probs(marginals1D, bins, input_samples,
                             filename = "validation_smooth",
                             file_extension = ".eps")