Beispiel #1
0
def test_range_relu(min_degree, max_degree, step):
    test_set = settings.create_test_set(settings.num_examples, max_value)
    approx_funcs = []
    for degree in range(min_degree, max_degree, step):
        approx_funcs.append( (relu_activation.get_approx_func(degree), "Poly Degree: %s" % (degree)) )
    run_multi_test(test_set, approx_funcs, relu_activation.get_real_func(), "Relu-Chebyshev")
Beispiel #2
0
def test_relu(max_degree):
    test_set = settings.create_test_set(settings.num_examples, max_value)
    run_test(test_set, relu_activation.get_approx_func(max_degree), relu_activation.get_real_func(), "Relu-Chabyshev")
Beispiel #3
0
def test_sigmoid_taylor():
    test_set = settings.create_test_set(settings.num_examples, max_value_taylor)
    run_test(test_set, sigmoid_activation.get_approx_func_taylor(), sigmoid_activation.get_real_func_sigmoid(),
             "Sigmoid-taylor")
Beispiel #4
0
def test_relu_polyfit():
    # Least squares polynomial fit
    test_set = settings.create_test_set(settings.num_examples, max_value)
    run_test(test_set, relu_activation.get_approx_func_polyfit(), relu_activation.get_real_func(),
             "Relu-polyfit")
Beispiel #5
0
def test_relu_taylor():
    test_set = settings.create_test_set(settings.num_examples, max_value_taylor)
    run_test(test_set, sigmoid_activation.get_approx_func_taylor_integ(), relu_activation.get_real_func(),
             "Relu-taylor-Sigmoid-Integral")
Beispiel #6
0
def test_sigmoid_chabyshev(max_degree):
    test_set = settings.create_test_set(settings.num_examples, max_value)
    run_test(test_set, sigmoid_activation.get_approx_func_chebyshev(max_degree), sigmoid_activation.get_real_func_sigmoid(),
             "Sigmoid-Chabyshev")