Repository navigation
Expand file tree
/
Copy path_ExampleData.py
More file actions
62 lines (51 loc) · 1.44 KB
/
Copy path_ExampleData.py
File metadata and controls
62 lines (51 loc) · 1.44 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""
File for declaring example data
"""
def get_simple_example():
features = ["yellow", "round", "long"]
classes = ["banana", "apple"]
training_data = [
# yellow, round, long | class
([1, 0, 1], "banana"),
([1, 0, 1], "banana"),
([0, 1, 0], "apple"),
]
test_inputs = [
([1, 0, 1], "banana"),
([0, 1, 0], "apple"),
]
return features, classes, training_data, test_inputs
def get_complex_example():
features = [
"yellow",
"red",
"green",
"round",
"long",
"sweet",
"crunchy",
"soft",
]
classes = [
"banana",
"apple",
"pear",
]
training_data = [
# yellow, red, green, round, long, sweet, crunchy, soft | class
([1, 0, 0, 0, 1, 1, 0, 1], "banana"),
([1, 0, 0, 0, 1, 1, 0, 1], "banana"),
([1, 0, 0, 0, 1, 1, 0, 1], "banana"),
([0, 1, 0, 1, 0, 1, 1, 0], "apple"),
([0, 1, 0, 1, 0, 1, 1, 0], "apple"),
([0, 0, 1, 1, 0, 1, 1, 0], "apple"), # green apple
([0, 0, 1, 0, 1, 1, 0, 1], "pear"),
([0, 0, 1, 0, 1, 1, 0, 1], "pear"),
([1, 0, 1, 0, 1, 1, 0, 1], "pear"), # yellow-green pear
]
test_inputs = [
([1, 0, 0, 0, 1, 1, 0, 1], "banana"),
([0, 1, 0, 1, 0, 1, 1, 0], "apple"),
([0, 0, 1, 0, 1, 1, 0, 1], "pear"),
]
return features, classes, training_data, test_inputs