コード例 #1
0
def t7():
    input_8 = [0.75, 0.2, 0.2, 0.1, 0.5]
    epsilon_8 = 0.1
    delta_8 = 0.1
    output_8 = chowreconstruct.cr1(input_8, epsilon_8, delta_8)
    print(output_8)
    print(exact_chow(output_8))
コード例 #2
0
def t8():
    weights = generate_sample_weights(4, 0, 10)
    print(weights)
    chow_params = exact_chow(weights)
    print(chow_params)
    output_9 = chowreconstruct.cr1(chow_params, 0.15, 0.1)
    print(output_9)
    c_p_output = exact_chow(output_9)
    print(c_p_output)
コード例 #3
0
def t_n(n, x):
    for i in range(0, x):
        weights = generate_sample_weights(n, 0, 10)
        chow_params = exact_chow(weights)
        output = chowreconstruct.cr1(chow_params, 0.15, 0.1)
        chow_output = exact_chow(output)
        distance = chowreconstruct.l2_distance(chow_params, chow_output)
        if distance > 0.15:
            warnings.warn("failure")
            print(chow_params)
            print(chow_output)
コード例 #4
0
def t6():
    input_7 = [0.75, 0.25, 0.25, 0.25]
    epsilon_7 = 0.1
    delta_7 = 0.1
    m_7 = 14023
    n_7 = 4
    output_7 = chowreconstruct.cr1(input_7, epsilon_7, delta_7)
    print(output_7)
    output_8 = chowreconstruct.approximate(output_7, m_7, n_7)
    assert(output_8[0] - input_7[0] < 0.1)
    assert(output_8[1] - input_7[1] < 0.1)
    assert(output_8[2] - input_7[2] < 0.1)
    assert(output_8[3] - input_7[3] < 0.1)