-
Notifications
You must be signed in to change notification settings - Fork 72
ExtendingCoreModules
Ioannis Stais edited this page May 14, 2017
·
3 revisions
The core modules of lightbulb, are the interfaces to the implementations of learning algorithms. You can insert here your own learning algorithm variation.
In order to extend the core modules, you have to place a file with the request format in folder located at "lightbulb/core/modules/"
META = {
'author': 'Your name goes here',
'name': 'NAME OF THE ALGORITHM AND THE CLASS AS DEFINED LATER',
'description': 'Short description',
'type': 'CORE',
'options': [
('OPTION NAME IN CAPITALS', "default value", Boolean value indicating if it is required, 'Short Description for the option'),
],
'comments': ['Comments go here']
}
class NAME_OF_THE_ALGORITHM_AND_THE_CLASS():
def setup(self, configuration):
"""
Sets the variables instances
Args:
configuration (dict): A user provided dictionary
with values defined through lightbulb CLI
Returns:
None
"""
self.sample_option_name = configuration['OPTION NAME IN CAPITALS']
def getresult(self):
"""
Returns the bypass string
Args:
None
Returns:
str: The bypass string
"""
def learn(self):
"""Initiates learning algorithm"""
def query(self, input_string):
"""
The function that performs the query and should be
overriden
Args:
input_string (str): Input for the target Mealy machine
Returns:
bool: the output of the target Mealy Machine on input input_string.
"""
def stats(self):
"""Prints exe'''cution statistics"""
stats = [
('Name', 'result'),
]