remosleandre
commited on
Commit
·
9d524af
1
Parent(s):
df46694
[ADD]first push of a model
Browse files- conversion.py +67 -0
- dataset_states.csv +448 -0
- model.py +222 -0
- model_weights.pth +3 -0
- training_model.ipynb +0 -0
conversion.py
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import pandas as pd
|
3 |
+
import torch.nn as nn
|
4 |
+
|
5 |
+
class CSVToTensor:
|
6 |
+
def __init__(self, file_path):
|
7 |
+
self.data_frame = pd.read_csv(file_path)
|
8 |
+
len_dataset = len(self.data_frame)
|
9 |
+
self.game_tensor = torch.zeros((len_dataset, 9), dtype=torch.float32)
|
10 |
+
self.prediction_tensor = torch.zeros((len_dataset, 9), dtype=torch.float32)
|
11 |
+
|
12 |
+
def csv_to_tensor(self, pos):
|
13 |
+
if pos >= len(self.data_frame):
|
14 |
+
raise ValueError("Position is greater than the number of data in the dataset")
|
15 |
+
|
16 |
+
data_pos = self.data_frame.iloc[pos]
|
17 |
+
game_stat = data_pos.values[0:9]
|
18 |
+
prediction_stat = data_pos.values[9:18]
|
19 |
+
|
20 |
+
self.game_tensor[pos] = torch.tensor(game_stat, dtype=torch.float32)
|
21 |
+
self.prediction_tensor[pos] = torch.tensor(prediction_stat, dtype=torch.float32)
|
22 |
+
|
23 |
+
def tensor_to_view(self, pos):
|
24 |
+
if pos >= len(self.data_frame):
|
25 |
+
raise ValueError("Position is greater than the number of data in the dataset")
|
26 |
+
|
27 |
+
if torch.equal(self.game_tensor[pos], torch.zeros(9)) or torch.equal(self.prediction_tensor[pos], torch.zeros(9)):
|
28 |
+
raise ValueError("No tensor data found at this position")
|
29 |
+
|
30 |
+
symbols = {0: ' ', 1: 'x', 2: 'o', 3: 'O'}
|
31 |
+
board = []
|
32 |
+
for i in range(9):
|
33 |
+
if self.game_tensor[pos][i] == 1:
|
34 |
+
board.append(1)
|
35 |
+
elif self.game_tensor[pos][i] == 2:
|
36 |
+
board.append(2)
|
37 |
+
elif self.prediction_tensor[pos][i] == 2:
|
38 |
+
board.append(3)
|
39 |
+
else:
|
40 |
+
board.append(0)
|
41 |
+
|
42 |
+
print("\nCurrent Game State:")
|
43 |
+
for i in range(0, 9, 3):
|
44 |
+
print(f"{symbols[board[i]]} | {symbols[board[i+1]]} | {symbols[board[i+2]]}")
|
45 |
+
if i < 6:
|
46 |
+
print("---------")
|
47 |
+
|
48 |
+
def print_data(self):
|
49 |
+
print(self.data_frame)
|
50 |
+
|
51 |
+
def create_all_tensor(self):
|
52 |
+
for i in range(len(self.data_frame)):
|
53 |
+
self.csv_to_tensor(i)
|
54 |
+
return self.game_tensor, self.prediction_tensor
|
55 |
+
|
56 |
+
def create_a_dataset(self):
|
57 |
+
return torch.utils.data.TensorDataset(self.game_tensor, self.prediction_tensor)
|
58 |
+
|
59 |
+
|
60 |
+
if __name__ == '__main__':
|
61 |
+
position = 0
|
62 |
+
tensor = CSVToTensor('./Datasets/example.csv')
|
63 |
+
tensor.print_data()
|
64 |
+
tensor.csv_to_tensor(position)
|
65 |
+
print(f"Input : {tensor.game_tensor[position]}")
|
66 |
+
print(f"Output : {tensor.prediction_tensor[position]}")
|
67 |
+
tensor.tensor_to_view(position)
|
dataset_states.csv
ADDED
@@ -0,0 +1,448 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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9 |
+
def __init__(self) -> None:
|
10 |
+
super(Architecture, self).__init__()
|
11 |
+
self.input_size = 9
|
12 |
+
self.hidden_size_1 = 9
|
13 |
+
self.hidden_size_2 = 9
|
14 |
+
self.hidden_size_3 = 9
|
15 |
+
self.hidden_size_4 = 9
|
16 |
+
self.hidden_size_5 = 9
|
17 |
+
self.hidden_size_6 = 9
|
18 |
+
self.hidden_size_7 = 9
|
19 |
+
self.output_size = 9
|
20 |
+
|
21 |
+
self.fc1 = nn.Linear(self.input_size, self.hidden_size_1)
|
22 |
+
self.fc2 = nn.Linear(self.hidden_size_1, self.hidden_size_2)
|
23 |
+
self.fc3 = nn.Linear(self.hidden_size_2, self.hidden_size_3)
|
24 |
+
self.fc4 = nn.Linear(self.hidden_size_3, self.hidden_size_4)
|
25 |
+
self.fc5 = nn.Linear(self.hidden_size_4, self.hidden_size_5)
|
26 |
+
self.fc6 = nn.Linear(self.hidden_size_5, self.hidden_size_6)
|
27 |
+
self.fc7 = nn.Linear(self.hidden_size_6, self.hidden_size_7)
|
28 |
+
self.fc8 = nn.Linear(self.hidden_size_7, self.output_size)
|
29 |
+
|
30 |
+
self.loss = nn.CrossEntropyLoss()
|
31 |
+
self.relu = nn.ReLU()
|
32 |
+
|
33 |
+
def inference(self, x):
|
34 |
+
with torch.no_grad():
|
35 |
+
x1 = self.relu(self.fc1(x))
|
36 |
+
x2 = self.relu(self.fc2(x1))
|
37 |
+
x3 = self.relu(self.fc3(x2))
|
38 |
+
x4 = self.relu(self.fc4(x3))
|
39 |
+
x5 = self.relu(self.fc5(x4))
|
40 |
+
x6 = self.relu(self.fc6(x5))
|
41 |
+
x7 = self.relu(self.fc7(x6))
|
42 |
+
x8 = self.fc8(x7)
|
43 |
+
return x8
|
44 |
+
|
45 |
+
def load_model():
|
46 |
+
model = Architecture()
|
47 |
+
model.load_state_dict(torch.load('fine_tune_model_weights.pth'))
|
48 |
+
return model
|
49 |
+
|
50 |
+
def inference_model(model, input):
|
51 |
+
return model.inference(input)
|
52 |
+
|
53 |
+
def minimax(board, depth, is_maximizing):
|
54 |
+
if check_winner(board) == 2: # AI wins
|
55 |
+
return 1
|
56 |
+
if check_winner(board) == 1: # Human wins
|
57 |
+
return -1
|
58 |
+
if check_winner(board) == 3: # Draw
|
59 |
+
return 0
|
60 |
+
|
61 |
+
if is_maximizing:
|
62 |
+
best_score = -math.inf
|
63 |
+
for i in range(9):
|
64 |
+
if board[i] == 0:
|
65 |
+
board[i] = 2 # AI's move
|
66 |
+
score = minimax(board, depth + 1, False)
|
67 |
+
board[i] = 0
|
68 |
+
best_score = max(score, best_score)
|
69 |
+
return best_score
|
70 |
+
else:
|
71 |
+
best_score = math.inf
|
72 |
+
for i in range(9):
|
73 |
+
if board[i] == 0:
|
74 |
+
board[i] = 1 # Human's move
|
75 |
+
score = minimax(board, depth + 1, True)
|
76 |
+
board[i] = 0
|
77 |
+
best_score = min(score, best_score)
|
78 |
+
return best_score
|
79 |
+
|
80 |
+
def best_move_minimax(board):
|
81 |
+
best_score = -math.inf
|
82 |
+
move = None
|
83 |
+
for i in range(9):
|
84 |
+
if board[i] == 0:
|
85 |
+
board[i] = 2 # AI's move
|
86 |
+
score = minimax(board, 0, False)
|
87 |
+
board[i] = 0
|
88 |
+
if score > best_score:
|
89 |
+
best_score = score
|
90 |
+
move = i
|
91 |
+
return move
|
92 |
+
|
93 |
+
def oracle(board, position):
|
94 |
+
output_board = [0] * 9
|
95 |
+
output_board[position] = 2
|
96 |
+
|
97 |
+
# Get minimax prediction
|
98 |
+
minimax_move = best_move_minimax(board)
|
99 |
+
|
100 |
+
# Compare oracle's move with minimax prediction
|
101 |
+
if minimax_move == position:
|
102 |
+
return 1 # Predictions match
|
103 |
+
else:
|
104 |
+
return -1 # Predictions differ
|
105 |
+
|
106 |
+
|
107 |
+
def print_in_csv(board, position, comparison_result):
|
108 |
+
output_board = [0] * 9
|
109 |
+
output_board[position] = 2
|
110 |
+
with open('game_state.csv', 'a', newline='') as f:
|
111 |
+
writer = csv.writer(f)
|
112 |
+
writer.writerow([
|
113 |
+
','.join(map(str, board)),
|
114 |
+
','.join(map(str, output_board)),
|
115 |
+
comparison_result
|
116 |
+
])
|
117 |
+
|
118 |
+
def decode_prediction(prediction, board):
|
119 |
+
result = torch.argmax(prediction)
|
120 |
+
position = result.item()
|
121 |
+
comparison_result = oracle(board, position)
|
122 |
+
print(f'Oracle comparison result: {comparison_result}')
|
123 |
+
print_in_csv(board, position, comparison_result)
|
124 |
+
board[position] = 2
|
125 |
+
return board
|
126 |
+
|
127 |
+
def encode_input(input):
|
128 |
+
return torch.tensor(input, dtype=torch.float32)
|
129 |
+
|
130 |
+
|
131 |
+
def play():
|
132 |
+
model = load_model()
|
133 |
+
model.eval()
|
134 |
+
print(model.inference(torch.randn(9)))
|
135 |
+
|
136 |
+
|
137 |
+
def print_board(board):
|
138 |
+
|
139 |
+
visual_board = [' ' if x == 0 else 'X' if x == 1 else 'O' for x in board]
|
140 |
+
|
141 |
+
print(f'{visual_board[0]} | {visual_board[1]} | {visual_board[2]}')
|
142 |
+
print('---------')
|
143 |
+
print(f'{visual_board[3]} | {visual_board[4]} | {visual_board[5]}')
|
144 |
+
print('---------')
|
145 |
+
print(f'{visual_board[6]} | {visual_board[7]} | {visual_board[8]}')
|
146 |
+
print('---------')
|
147 |
+
|
148 |
+
|
149 |
+
def check_winner(board):
|
150 |
+
# Check rows
|
151 |
+
for i in range(0, 9, 3):
|
152 |
+
if board[i] == board[i + 1] == board[i + 2] == 1:
|
153 |
+
return 1
|
154 |
+
if board[i] == board[i + 1] == board[i + 2] == 2:
|
155 |
+
return 2
|
156 |
+
|
157 |
+
# Check columns
|
158 |
+
for i in range(3):
|
159 |
+
if board[i] == board[i + 3] == board[i + 6] == 1:
|
160 |
+
return 1
|
161 |
+
if board[i] == board[i + 3] == board[i + 6] == 2:
|
162 |
+
return 2
|
163 |
+
|
164 |
+
# Check diagonals
|
165 |
+
if board[0] == board[4] == board[8] == 1:
|
166 |
+
return 1
|
167 |
+
if board[0] == board[4] == board[8] == 2:
|
168 |
+
return 2
|
169 |
+
|
170 |
+
if board[2] == board[4] == board[6] == 1:
|
171 |
+
return 1
|
172 |
+
if board[2] == board[4] == board[6] == 2:
|
173 |
+
return 2
|
174 |
+
|
175 |
+
# Check for a draw
|
176 |
+
if all(cell != 0 for cell in board):
|
177 |
+
return 3
|
178 |
+
|
179 |
+
return 0
|
180 |
+
|
181 |
+
|
182 |
+
def simulate_game():
|
183 |
+
|
184 |
+
board = [0, 0, 0, 0, 0, 0, 0, 0, 0]
|
185 |
+
end = False
|
186 |
+
|
187 |
+
while end != True:
|
188 |
+
print_board(board)
|
189 |
+
move = int(input('Enter move: '))
|
190 |
+
if move <= 9 and move >= 1 and board[move - 1] == 0:
|
191 |
+
board[move - 1] = 1
|
192 |
+
print_board(board)
|
193 |
+
if check_winner(board) == 1:
|
194 |
+
print('You win')
|
195 |
+
end = True
|
196 |
+
break
|
197 |
+
if check_winner(board) == 3:
|
198 |
+
print('Draw')
|
199 |
+
end = True
|
200 |
+
break
|
201 |
+
print('Computer is thinking...')
|
202 |
+
intput = encode_input(board)
|
203 |
+
model = load_model()
|
204 |
+
prediction = inference_model(model, intput)
|
205 |
+
output = decode_prediction(prediction, board)
|
206 |
+
board = output
|
207 |
+
if check_winner(board) == 2:
|
208 |
+
print_board(board)
|
209 |
+
print('Computer wins')
|
210 |
+
end = True
|
211 |
+
break
|
212 |
+
if check_winner(board) == 3:
|
213 |
+
print('Draw')
|
214 |
+
end = True
|
215 |
+
break
|
216 |
+
|
217 |
+
else:
|
218 |
+
print('Invalid move')
|
219 |
+
|
220 |
+
|
221 |
+
if __name__ == '__main__':
|
222 |
+
simulate_game()
|
model_weights.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9c13e13f96c58cb16d7e227a05eaa3e3d50031683cd259f557205c7992f83d1b
|
3 |
+
size 7966
|
training_model.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|