oiuhhiu
This commit is contained in:
parent
00974b0f11
commit
260c32d909
33
network.py
33
network.py
|
@ -312,7 +312,7 @@ class Network:
|
||||||
# start = time.time()
|
# start = time.time()
|
||||||
|
|
||||||
list_of_moves = []
|
list_of_moves = []
|
||||||
|
test_list = []
|
||||||
# Prepping of data
|
# Prepping of data
|
||||||
for idx, board in enumerate(boards):
|
for idx, board in enumerate(boards):
|
||||||
all_board_moves = []
|
all_board_moves = []
|
||||||
|
@ -321,16 +321,41 @@ class Network:
|
||||||
for state in all_states:
|
for state in all_states:
|
||||||
state = np.array(self.board_trans_func(state, player*-1)[0])
|
state = np.array(self.board_trans_func(state, player*-1)[0])
|
||||||
all_board_moves.append(state)
|
all_board_moves.append(state)
|
||||||
|
test_list.append(state)
|
||||||
list_of_moves.append(np.array(all_board_moves))
|
list_of_moves.append(np.array(all_board_moves))
|
||||||
|
|
||||||
|
|
||||||
# print(time.time() - start)
|
list_of_lengths = [len(board) for board in list_of_moves]
|
||||||
# start = time.time()
|
|
||||||
|
|
||||||
# Running data through networks
|
start = time.time()
|
||||||
|
for i in range(len(test_list)):
|
||||||
|
self.model.predict_on_batch(np.array([state]))
|
||||||
|
print("Indiviual rolls:", time.time() - start)
|
||||||
all_scores = [self.model.predict_on_batch(board) for board in list_of_moves]
|
all_scores = [self.model.predict_on_batch(board) for board in list_of_moves]
|
||||||
|
|
||||||
|
|
||||||
|
start = time.time()
|
||||||
|
all_scores_legit = self.model.predict_on_batch(np.array(test_list))
|
||||||
|
|
||||||
|
split_scores = []
|
||||||
|
from_idx = 0
|
||||||
|
for length in list_of_lengths:
|
||||||
|
split_scores.append(all_scores_legit[from_idx:from_idx+length])
|
||||||
|
from_idx += length
|
||||||
|
|
||||||
|
transformed_splits = [tf.reduce_mean(scores) for scores in split_scores]
|
||||||
|
|
||||||
|
print(transformed_splits)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print("All in one:", time.time() - start)
|
||||||
|
|
||||||
scores_means = [tf.reduce_mean(score) for score in all_scores]
|
scores_means = [tf.reduce_mean(score) for score in all_scores]
|
||||||
|
|
||||||
|
print(scores_means)
|
||||||
|
|
||||||
transformed_means = [x if player == 1 else (1-x) for x in scores_means]
|
transformed_means = [x if player == 1 else (1-x) for x in scores_means]
|
||||||
|
|
||||||
# print(time.time() - start)
|
# print(time.time() - start)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user