예제 #1
0
def test_Model():
    """ """
    M = sb.Model()
    x = np.linspace(0.1, 0.9, 22)
    target_mu = 0.5
    target_sigma = 1
    target_y = sb.cumgauss(x, target_mu, target_sigma)
    F = M.fit(x, target_y, initial=[target_mu, target_sigma])
    npt.assert_equal(F.predict(x), target_y)
예제 #2
0
def test_Model():
    """ """
    M = sb.Model()
    x = np.linspace(0.1, 0.9, 22)
    target_mu = 0.5
    target_sigma = 1
    target_y = sb.cumgauss(x, target_mu, target_sigma)
    F = M.fit(x, target_y, initial=[target_mu, target_sigma])
    npt.assert_equal(F.predict(x), target_y)
예제 #3
0
def test_cum_gauss():
    sigma = 1
    mu = 0
    x = np.linspace(-1, 1, 12)
    y = sb.cumgauss(x, mu, sigma)
    # A basic test that the input and output have the same shape:
    npt.assert_equal(y.shape , x.shape)
    # The function evaluated over items symmetrical about mu should be 
    # symmetrical relative to 0 and 1:
    npt.assert_equal(y[0], 1 - y[-1])
    # Approximately 68% of the Gaussian distribution is in mu +/- sigma, so 
    # the value of the cumulative Gaussian at mu - sigma should be
    # approximately equal to (1 - 0.68/2). Note the low precision!
    npt.assert_almost_equal(y[0], (1 - 0.68) / 2, decimal=2)
예제 #4
0
def test_cum_gauss():
    sigma = 1
    mu = 0
    x = np.linspace(-1, 1, 12)
    y = sb.cumgauss(x, mu, sigma)
    # A basic test that the input and output have the same shape:
    npt.assert_equal(y.shape, x.shape)
    # The function evaluated over items symmetrical about mu should be
    # symmetrical relative to 0 and 1:
    npt.assert_equal(y[0], 1 - y[-1])
    # Approximately 68% of the Gaussian distribution is in mu +/- sigma, so
    # the value of the cumulative Gaussian at mu - sigma should be
    # approximately equal to (1 - 0.68/2). Note the low precision!
    npt.assert_almost_equal(y[0], (1 - 0.68) / 2, decimal=2)