forked from h80r-uft/IA-py-network
-
Notifications
You must be signed in to change notification settings - Fork 0
/
car_test.py
34 lines (22 loc) · 783 Bytes
/
car_test.py
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
from typing import List, Tuple
from network import Network
def read_training_data(filename: str) -> List[Tuple[List[str], List[str]]]:
inputs = []
training_data = []
with open(filename, "r") as file:
for line in file:
for word in line.split(","):
inputs.append(line)
expected = [x for x in line.split(",")][-1]
print(inputs)
training_data.append((inputs, expected))
return training_data
def main() -> None:
training_data = read_training_data("car.data")
network = Network(training_data, 0.5, 1000, 1)
# print(network.predict([0, 0]))
# print(network.predict([0, 1]))
# print(network.predict([1, 0]))
# print(network.predict([1, 1]))
if __name__ == "__main__":
main()