Пример #1
0
def test_FANN_converges_on_and_problem():
    fc = FullConnection(2, 1)
    sig = SigmoidLayer(1)
    nn = FANN([fc, sig])
    and_ = load_and()
    theta = np.array([-0.1, 0.1])
    for i in range(100):
        g = nn.calculate_gradient(theta, and_.data, and_.target)
        theta -= g * 1
    error = nn.calculate_error(theta, and_.data, and_.target)
    assert_less(error, 0.2)
Пример #2
0
def test_FANN_converges_on_and_problem():
    fc = FullConnection(2, 1)
    sig = SigmoidLayer(1)
    nn = FANN([fc, sig])
    and_ = load_and()
    theta = np.array([-0.1, 0.1])
    for i in range(100):
        g = nn.calculate_gradient(theta, and_.data, and_.target)
        theta -= g * 1
    error = nn.calculate_error(theta, and_.data, and_.target)
    assert_less(error,  0.2)
Пример #3
0
def test_load_and_wellformed() :
    and_problem = load_and()
    assert_dataset_wellformed(and_problem)