v0.5.0: behavior learning, shadow prediction and safe activation #32
@@ -41,7 +41,14 @@ class BehaviorEngine:
|
||||
self._settings = settings
|
||||
|
||||
def train_all(self) -> list[ActuatorRecord]:
|
||||
return [self.train(record.actuator_entity_id) for record in self._store.list()]
|
||||
results: list[ActuatorRecord] = []
|
||||
for record in self._store.list():
|
||||
try:
|
||||
results.append(self.train(record.actuator_entity_id))
|
||||
except Exception:
|
||||
logger.exception("Behavior training failed for %s", record.actuator_entity_id)
|
||||
results.append(record)
|
||||
return results
|
||||
|
||||
def train(self, actuator_entity_id: str) -> ActuatorRecord:
|
||||
record = self._store.get(actuator_entity_id)
|
||||
@@ -143,7 +150,14 @@ class BehaviorEngine:
|
||||
return self._save_behavior(record, behavior)
|
||||
|
||||
def evaluate_all(self) -> list[ActuatorRecord]:
|
||||
return [self.evaluate(record.actuator_entity_id) for record in self._store.list()]
|
||||
results: list[ActuatorRecord] = []
|
||||
for record in self._store.list():
|
||||
try:
|
||||
results.append(self.evaluate(record.actuator_entity_id))
|
||||
except Exception:
|
||||
logger.exception("Behavior evaluation failed for %s", record.actuator_entity_id)
|
||||
results.append(record)
|
||||
return results
|
||||
|
||||
def evaluate(self, actuator_entity_id: str) -> ActuatorRecord:
|
||||
record = self._store.get(actuator_entity_id)
|
||||
|
||||
Reference in New Issue
Block a user