コード例 #1
0
xs_lt_n6 = []
ys_lt_n6 = []

# 4) Fit Model

with open(args.data, "r") as f:
    file_lines = f.readlines()

for line in file_lines:
    #print( "reading " + str( line ) )
    split = line.split("\n")[0].split(",")
    my_assert_equals_thrower("split.length", len(split), 2)

    try:
        cpp_structs = jack_mouse_test.read_mouse_data(split[0], split[1])
        source_input = cpp_structs[0]
        ray_input = cpp_structs[1]
        output = cpp_structs[2]
        #source_input, ray_input, output = generate_data_from_files( line, False )
    except AssertError:
        continue
    predictions = model.predict(x=[source_input, ray_input])
    my_assert_equals_thrower("len( predictions )", len(predictions),
                             len(output))
    for i in range(0, len(predictions)):
        '''
        denorm_val=output[ i ][ 0 ]
        norm_val = denorm_val
        if norm_val > 1:
            norm_val = norm_val**0.75
コード例 #2
0
        for x in range(0, len(output_no_resid)):
            my_assert_equals_thrower("len(output_no_resid[x])",
                                     len(output_no_resid[x]), 1)
            val = output_no_resid[x][0]
            #Stunt large values
            if (val > 1):
                val = val**0.75
            #subtract mean of -2:
            val += 2.0
            #divide by span of 3:
            val /= 3.0
        return source_input_no_resid, ray_input_no_resid, output_no_resid


t0 = time.time()
cpp_structs = jack_mouse_test.read_mouse_data(input_file_path,
                                              output_file_path)
t1 = time.time()
py_res_input, py_ray_input, py_output = generate_data_from_files(
    input_file_path, output_file_path, False)
t2 = time.time()

if (len(cpp_structs) < 3):
    print("CPP found an exception")
    exit(cpp_structs[0])
cpp_res_input = cpp_structs[0]
cpp_ray_input = cpp_structs[1]
cpp_output = cpp_structs[2]

#print( cpp_output.shape )
#print( py_output.shape )
#exit( 0 )