コード例 #1
0
def test_gen_sample_by_factors():
    test_GUMP_SCENES_IDS = [26, 36, 25, 38]
    g1=gen_sample_by_factors(test_GUMP_SCENES_IDS, factor_grid, False)
    f3=list(g1[0].values())[0]
    r3=(np.array([128, 129, 130, 131, 132, 133, 134, 135, 136, 137]),
        np.array([138, 139, 140, 141, 142, 143, 144, 145, 146, 147]))
    f4=g1[1]
    r4=[25]
    assert_almost_equal(f3,r3)
    assert_almost_equal(f4,r4)
コード例 #2
0
        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
        0,  0,  0, 66, 66, 66, 66, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,
        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
        0,  0,  0,  0,  0,  0,  0, 66, 66, 66, 66, 66, 66, 66,  0,  0,  0,
        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
        0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 66, 66])
    assert_almost_equal(f2,r2)


test_GUMP_SCENES_IDS = [26, 36, 25, 38]
samp_gump, miss_gump = gen_sample_by_factors(test_GUMP_SCENES_IDS, factor_grid, False)
 
def test_gen_sample_by_factors():
    test_GUMP_SCENES_IDS = [26, 36, 25, 38]
    g1=gen_sample_by_factors(test_GUMP_SCENES_IDS, factor_grid, False)
    f3=list(g1[0].values())[0]
    r3=(np.array([128, 129, 130, 131, 132, 133, 134, 135, 136, 137]),
        np.array([138, 139, 140, 141, 142, 143, 144, 145, 146, 147]))
    f4=g1[1]
    r4=[25]
    assert_almost_equal(f3,r3)
    assert_almost_equal(f4,r4)

def test_get_training_samples():
    r5 = np.array([128, 129, 130, 131, 132, 133, 134, 135, 136, 137])
    f5= list(get_training_samples(samp_gump).values())[0]