-
Notifications
You must be signed in to change notification settings - Fork 0
/
LowLevel.py
50 lines (41 loc) · 1.54 KB
/
LowLevel.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
This class represents the low-level model of the cognitive architecture. It performs training and execution of the
learning task.
"""
from Learner import Learner
from IntentionReader import IntentionReader
class LowLevel:
def __init__(self, transition_queue, logger, debug=False, offline=False, persist=False):
self.train = Learner(debug, persist=persist)
self.test = IntentionReader(debug, transition_queue, logger)
self.offline = offline
# Performs the training phase and outputs the training data
def do_training(self):
if self.offline:
self.train.offline_learning()
else:
self.train.learn()
return self.train.make_training_dataset()
# Reloads previously computed training data
def reload_training(self):
path = "objects/"
if self.offline:
path += "offline/"
self.train.reload_data(path)
return self.train.make_training_dataset()
# Updates the knowledge base
def update_knowledge(self):
self.train.update_knowledge()
return self.train.make_training_dataset()
# Performs skeleton extraction, clustering and transition analysis
def do_testing(self, simulation=False, debug=False):
self.test.set_environment(self.train)
if debug:
self.test.debug_observe()
elif simulation:
self.test.observer_simulator()
else:
if self.offline:
self.test.offline_observe()
else:
self.test.observe()