-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathread_eval_csv.py
More file actions
38 lines (28 loc) · 862 Bytes
/
read_eval_csv.py
File metadata and controls
38 lines (28 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import numpy as np
from sys import argv, exit
argc = len(argv)
usage = "evaluations features outfile"
if argc < 4:
print usage
exit()
e = open(argv[1], "r")
f = open(argv[2], "r")
curr_game = 0
max_positions = 380000
#max_positions = 10
features = 323
training_x = np.zeros((max_positions, features))
training_y = np.zeros(max_positions)
for game in xrange(max_positions):
evals = np.array(map(float,e.readline().strip().split(",")))
npositions = evals.size
pos_number = np.random.randint(0,npositions)
# print "Choosing Position number %d" % pos_number
training_y[game] = evals[pos_number]
for j in xrange(evals.size+1):
if j == pos_number:
line = f.readline()
training_x[game, :] = np.array(map(float,line.strip().split(",")))
else:
f.readline()
np.savez(argv[3], training_x = training_x, training_y = training_y)