-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a planning intrface and renamed the DDL interface to learners. …
…Now we have planners and learners. Closes #50
- Loading branch information
Evana Gizzi
committed
Oct 5, 2023
1 parent
f13b245
commit 26e6de8
Showing
11 changed files
with
82 additions
and
36 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# GSC-19165-1, "The On-Board Artificial Intelligence Research (OnAIR) Platform" | ||
# | ||
# Copyright © 2023 United States Government as represented by the Administrator of | ||
# the National Aeronautics and Space Administration. No copyright is claimed in the | ||
# United States under Title 17, U.S. Code. All Other Rights Reserved. | ||
# | ||
# Licensed under the NASA Open Source Agreement version 1.3 | ||
# See "NOSA GSC-19165-1 OnAIR.pdf" | ||
|
||
""" | ||
Planners interface class for managing all planning-based AI components | ||
""" | ||
import importlib.util | ||
import importlib.util | ||
|
||
from ..util.data_conversion import * | ||
|
||
class PlannersInterface: | ||
def __init__(self, headers, _ai_plugins={}): | ||
assert(len(headers)>0), 'Headers are required' | ||
self.headers = headers | ||
self.planning_constructs = [] | ||
for module_name in list(_planning_plugins.keys()): | ||
spec = importlib.util.spec_from_file_location(module_name, _planning_plugins[module_name]) | ||
module = importlib.util.module_from_spec(spec) | ||
spec.loader.exec_module(module) | ||
self.planning_constructs.append(module.Plugin(module_name,headers)) | ||
|
||
def update(self, curr_data, status): | ||
input_data = curr_data | ||
output_data = status_to_oneHot(status) | ||
for plugin in self.planning_constructs: | ||
plugin.update(input_data) | ||
|
||
def apriori_training(self, batch_data): | ||
for plugin in self.planning_constructs: | ||
plugin.apriori_training(batch_data) | ||
|
||
def render_reasoning(self): | ||
diagnoses = {} | ||
for plugin in self.planning_constructs: | ||
diagnoses[plugin.component_name] = plugin.render_reasoning() | ||
return diagnoses | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters