Fork me on GitHub

pyhrf.validation.valid_beta_estim module

class pyhrf.validation.valid_beta_estim.ObsField2DTest(methodName='runTest')

Bases: unittest.case.TestCase

Test estimation of beta with on observed 2D fields

MC_comp_pfmethods_ML(shape)
MC_comp_pfmethods_ML_3C(shape)
setUp()

Hook method for setting up the test fixture before exercising it.

test_MC_comp_pfmethods_ML_100x100()
test_MC_comp_pfmethods_ML_10x10()
test_MC_comp_pfmethods_ML_30x30()
test_MC_comp_pfmethods_ML_3C_10x10()
test_MC_comp_pfmethods_ML_3C_20x20()
test_MC_comp_pfmethods_ML_3C_30x30()
test_MC_comp_pfmethods_ML_3C_50x50()
test_single_Onsager_MAP()

PF method: Onsager. MAP on p(label|beta).

test_single_Onsager_ML()

PF method: Onsager. ML on p(beta|label).

test_single_PFES_MAP()

PF estimation method : extrapolation scheme. MAP on p(beta|label).

test_single_PFES_ML()

PF estimation method : extrapolation scheme. ML on p(label|beta).

test_single_PFPS_MAP()

PF estimation method : path sampling. MAP on p(beta|label).

test_single_PFPS_ML()

PF estimation method : path sampling. ML on p(label|beta).

test_single_surface_PFPS_ML()

PF estimation method : path sampling. ML on p(label|beta). topology from a surfacic RDI

pyhrf.validation.valid_beta_estim.beta_estim_obs_field_mc(graph, nbClasses, beta, gridLnz, mcit=1, cachePotts=False)
pyhrf.validation.valid_beta_estim.dist(x, y)
pyhrf.validation.valid_beta_estim.randn(d0, d1, ..., dn)

Return a sample (or samples) from the “standard normal” distribution.

If positive, int_like or int-convertible arguments are provided, randn generates an array of shape (d0, d1, ..., dn), filled with random floats sampled from a univariate “normal” (Gaussian) distribution of mean 0 and variance 1 (if any of the d_i are floats, they are first converted to integers by truncation). A single float randomly sampled from the distribution is returned if no argument is provided.

This is a convenience function. If you want an interface that takes a tuple as the first argument, use numpy.random.standard_normal instead.

Parameters:d1, .., dn (d0,) – The dimensions of the returned array, should be all positive. If no argument is given a single Python float is returned.
Returns:Z – A (d0, d1, ..., dn)-shaped array of floating-point samples from the standard normal distribution, or a single such float if no parameters were supplied.
Return type:ndarray or float

See also

random.standard_normal()
Similar, but takes a tuple as its argument.

Notes

For random samples from N(\mu, \sigma^2), use:

sigma * np.random.randn(...) + mu

Examples

>>> np.random.randn()
2.1923875335537315 #random

Two-by-four array of samples from N(3, 6.25):

>>> 2.5 * np.random.randn(2, 4) + 3
array([[-4.49401501,  4.00950034, -1.81814867,  7.29718677],  #random
       [ 0.39924804,  4.68456316,  4.99394529,  4.84057254]]) #random
pyhrf.validation.valid_beta_estim.test_beta_estim_obs_fields(graphs, betas, nbLabels, pfmethod, mcit=1)