icub-client
|
This Module implements the core functionality to create Gaussian Process Latent Feature Models. More...
Modules | |
SAM Drivers | |
Drivers folder containing driver classes that inherit from SAMDriver to implement custom functionality. | |
Classes | |
class | SAM.SAM_Core.interactionSAMModel.interactionSAMModel |
Generic interaction function. More... | |
class | SAM.SAM_Core.SAMCore.LFM |
SAM based on Latent Feature Models. More... | |
class | SAM.SAM_Core.samOptimiser.modelOptClass |
Class to perform optimisation of SAM Models. More... | |
class | SAM.SAM_Core.samSupervisor.SamSupervisorModule |
Model management and supervisor. More... | |
class | SAM.SAM_Core.svi_ratio.SVI_Ratio |
Inference the marginal likelihood through {p(y,y*)}{p(y)}. More... | |
Functions | |
def | SAM.SAM_Core.SAMCore.save_model (mm, fileName='m_serialized.txt') |
Save serialised model. More... | |
def | SAM.SAM_Core.SAMCore.load_model (fileName='m_serialized.txt') |
Load serialised model. More... | |
def | SAM.SAM_Core.SAMCore.save_pruned_model (mm, fileName='m_pruned', economy=False, extraDict=dict()) |
Save a pruned model. More... | |
def | SAM.SAM_Core.SAMCore.load_pruned_model (fileName='m_pruned', economy=False, m=None) |
Load a pruned model. More... | |
def | SAM.SAM_Core.SAMCore.most_significant_input_dimensions (model) |
Determine the most descriptive output dimensions. More... | |
def | SAM.SAM_Core.trainSAMModel.exception_hook (exc_type, exc_value, exc_traceback) |
Generic training function. More... | |
This Module implements the core functionality to create Gaussian Process Latent Feature Models.
class SAM::SAM_Core::interactionSAMModel::interactionSAMModel |
Generic interaction function.
config_path
parameter of the default context file for samSupervisor.py. An example of the configuration structure is shown below.Examples
dataIn | The port name for the port that will received the data to be classified and the dataType to be expected. |
dataOut | The port name for the port that will output generated data and the dataType to be transmitted. |
rpcBase | The rpc port that will receive external requests. This is usually controlled by samSupervisor.py. |
call_sign | The commands that will trigger a classify from data event or a generate from label event. |
collectionMethod | The collection method to be used. Either buffered , future_buffered or continuous . Followed by an integer indicating the length of the buffer to be used. In the case of continuous the buffer length is the maximum number of classification labels to be stored in a First In Last Out (FILO) configuration. Otherwise the buffer length indicates the number of data frames that are required for a classification to take place. |
Definition at line 54 of file interactionSAMModel.py.
Public Member Functions | |
def | __init__ (self) |
Initialisation of the interaction function. More... | |
def | configure (self, rf) |
Configure interactionSAMModel yarp module. More... | |
def | close (self) |
Close Yarp module. More... | |
def | closePort (self, j) |
Helper function to close ports with an enforced timeout of 3 seconds so the module doesn't hang. More... | |
def | respond (self, command, reply) |
Respond to external requests. More... | |
def | classifyInstance (self, reply) |
Classify a live collected data instance. More... | |
def | generateInstance (self, reply, instanceName) |
Responds to an ask_X_instance request. More... | |
def | recallFromLabel (self, label) |
Generates instance based on label. More... | |
def | interruptModule (self) |
Module interrupt logic. More... | |
def | getPeriod (self) |
Module refresh rate. More... | |
def | updateModule (self) |
Logic to execute every getPeriod() seconds. More... | |
def | readFrame (self) |
Logic to read an available data frame. More... | |
def | collectData (self) |
Collect data function. More... | |
def | test (self) |
Utility function to test data collection procedures for debugging purposes. More... | |
Public Attributes | |
mm | |
dataPath | |
configPath | |
modelPath | |
driverName | |
model_type | |
model_mode | |
textLabels | |
classifiers | |
classif_thresh | |
verbose | |
Quser | |
listOfModels | |
portsList | |
svPort | |
labelPort | |
instancePort | |
callSignList | |
inputBottle | |
outputBottle | |
portNameList | |
rpcConnected | |
dataInConnected | |
dataOutConnected | |
collectionMethod | |
bufferSize | |
falseCount | |
noDataCount | |
inputType | |
outputType | |
errorRate | |
dataList | |
classificationList | |
closeFlag | |
instancePortName | |
labelPortName | |
verboseSetting | |
exitFlag | |
recordingFile | |
additionalInfoDict | |
modelLoaded | |
attentionMode | |
baseLogFileName | |
windowedMode | |
modelRoot | |
eventPort | |
eventPortName | |
classTimestamps | |
probClassList | |
recency | |
useRecentClassTime | |
my_mutex | |
def SAM.SAM_Core.interactionSAMModel.interactionSAMModel.__init__ | ( | self | ) |
Initialisation of the interaction function.
Definition at line 58 of file interactionSAMModel.py.
def SAM.SAM_Core.interactionSAMModel.interactionSAMModel.classifyInstance | ( | self, | |
reply | |||
) |
Classify a live collected data instance.
ask_x_label
request sent via the rpc port of the module. buffered
, the data currently in the buffer is sent to processLiveData() method for the current driver which returns a classification label that is embedded in reply.future_buffered
, this method reads incoming frames from the dataIn
port until the collection buffer is full at which point it calls processLiveData() to get a classification label.continuous
, this model returns the most recent label in the FILO buffer containing classification labels.reply | Outgoing Yarp bottle containing classification label. |
Definition at line 435 of file interactionSAMModel.py.
def SAM.SAM_Core.interactionSAMModel.interactionSAMModel.close | ( | self | ) |
Close Yarp module.
None |
Definition at line 299 of file interactionSAMModel.py.
def SAM.SAM_Core.interactionSAMModel.interactionSAMModel.closePort | ( | self, | |
j | |||
) |
Helper function to close ports with an enforced timeout of 3 seconds so the module doesn't hang.
j | Yarp Port |
Definition at line 316 of file interactionSAMModel.py.
def SAM.SAM_Core.interactionSAMModel.interactionSAMModel.collectData | ( | self | ) |
Collect data function.
Definition at line 731 of file interactionSAMModel.py.
def SAM.SAM_Core.interactionSAMModel.interactionSAMModel.configure | ( | self, | |
rf | |||
) |
Configure interactionSAMModel yarp module.
rf | Yarp RF context input |
argv_1 | String containing data path. |
argv_2 | String containing model path. |
argv_3 | String containing config file path (from config_path parameter of samSupervisor config file). |
argv_4 | String driver name corresponding to a valid driver present in SAM_Drivers folder. |
argv_5 | String 'True' or 'False' to switch formatting of logging depending on whether interaction is logging to a separate window or to the stdout of another process. |
Definition at line 128 of file interactionSAMModel.py.
def SAM.SAM_Core.interactionSAMModel.interactionSAMModel.generateInstance | ( | self, | |
reply, | |||
instanceName | |||
) |
Responds to an ask_X_instance request.
ask_X_instance
rpc request for instanceName. This method responds with an ack
or nack
on the rpc port indicating success of memory generation and outputs the generated instance returned by recallFromLabel on the dataOut
port.reply | Yarp Bottle to embed the rpc response. |
instanceName | Name of class to generate. |
Definition at line 584 of file interactionSAMModel.py.
def SAM.SAM_Core.interactionSAMModel.interactionSAMModel.getPeriod | ( | self | ) |
Module refresh rate.
Returns The period of the module in seconds.
Definition at line 651 of file interactionSAMModel.py.
def SAM.SAM_Core.interactionSAMModel.interactionSAMModel.interruptModule | ( | self | ) |
Module interrupt logic.
Returns Boolean indicating success of logic or not.
Definition at line 643 of file interactionSAMModel.py.
def SAM.SAM_Core.interactionSAMModel.interactionSAMModel.readFrame | ( | self | ) |
Logic to read an available data frame.
None
if the data type is not recognised. This is currently a limitation because ImageRgb
, ImageMono
and Bottle
are so far the only supported bottle types. This can be easily extended in this section by adding more cases.Returns Boolean indicating success of logic or not.
Definition at line 700 of file interactionSAMModel.py.
def SAM.SAM_Core.interactionSAMModel.interactionSAMModel.recallFromLabel | ( | self, | |
label | |||
) |
Generates instance based on label.
label | String containing the class label for the requested generated instance. |
Definition at line 625 of file interactionSAMModel.py.
def SAM.SAM_Core.interactionSAMModel.interactionSAMModel.respond | ( | self, | |
command, | |||
reply | |||
) |
Respond to external requests.
command | Incoming Yarp bottle containing external request. |
reply | Outgoing Yarp bottle containing reply to processed request. |
Definition at line 342 of file interactionSAMModel.py.
def SAM.SAM_Core.interactionSAMModel.interactionSAMModel.test | ( | self | ) |
Utility function to test data collection procedures for debugging purposes.
Definition at line 824 of file interactionSAMModel.py.
def SAM.SAM_Core.interactionSAMModel.interactionSAMModel.updateModule | ( | self | ) |
Logic to execute every getPeriod() seconds.
Returns Boolean indicating success of logic or not.
Definition at line 662 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.additionalInfoDict |
Definition at line 101 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.attentionMode |
Definition at line 103 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.baseLogFileName |
Definition at line 104 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.bufferSize |
Definition at line 86 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.callSignList |
Definition at line 77 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.classif_thresh |
Definition at line 69 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.classificationList |
Definition at line 94 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.classifiers |
Definition at line 68 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.classTimestamps |
Definition at line 109 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.closeFlag |
Definition at line 95 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.collectionMethod |
Definition at line 85 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.configPath |
Definition at line 62 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.dataInConnected |
Definition at line 83 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.dataList |
Definition at line 93 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.dataOutConnected |
Definition at line 84 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.dataPath |
Definition at line 61 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.driverName |
Definition at line 64 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.errorRate |
Definition at line 92 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.eventPort |
Definition at line 107 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.eventPortName |
Definition at line 108 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.exitFlag |
Definition at line 99 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.falseCount |
Definition at line 88 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.inputBottle |
Definition at line 78 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.inputType |
Definition at line 90 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.instancePort |
Definition at line 76 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.instancePortName |
Definition at line 96 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.labelPort |
Definition at line 75 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.labelPortName |
Definition at line 97 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.listOfModels |
Definition at line 72 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.mm |
Definition at line 60 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.model_mode |
Definition at line 66 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.model_type |
Definition at line 65 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.modelLoaded |
Definition at line 102 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.modelPath |
Definition at line 63 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.modelRoot |
Definition at line 106 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.my_mutex |
Definition at line 113 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.noDataCount |
Definition at line 89 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.outputBottle |
Definition at line 79 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.outputType |
Definition at line 91 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.portNameList |
Definition at line 80 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.portsList |
Definition at line 73 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.probClassList |
Definition at line 110 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.Quser |
Definition at line 71 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.recency |
Definition at line 111 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.recordingFile |
Definition at line 100 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.rpcConnected |
Definition at line 82 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.svPort |
Definition at line 74 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.textLabels |
Definition at line 67 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.useRecentClassTime |
Definition at line 112 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.verbose |
Definition at line 70 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.verboseSetting |
Definition at line 98 of file interactionSAMModel.py.
SAM.SAM_Core.interactionSAMModel.interactionSAMModel.windowedMode |
Definition at line 105 of file interactionSAMModel.py.
class SAM::SAM_Core::SAMCore::LFM |
SAM based on Latent Feature Models.
Definition at line 40 of file SAMCore.py.
Public Member Functions | |
def | __init__ (self) |
Initalise the Latent Feature Models. More... | |
def | store (self, observed, inputs=None, Q=None, kernel=None, num_inducing=None, init_X='PCA') |
Store events. More... | |
def | add_labels (self, labels) |
Add labels to observations. More... | |
def | learn (self, optimizer='bfgs', max_iters=1000, init_iters=300, verbose=True) |
Learn the model (analogous to "forming synapses" after perceiving data). More... | |
def | check_snr (self, warningEnable=True, messages=True) |
Checks the signal to noise ratio(SNR) of the trained model. More... | |
def | visualise (self, which_indices=None, plot_scales=True) |
Show the internal representation of the memory. More... | |
def | visualise_interactive (self, dimensions=(20, 28), transpose=True, order='F', invert=False, scale=False, colorgray=True, view=0, which_indices=(0, 1)) |
Interactive plot of the model. More... | |
def | recall (self, locations) |
Recall stored events. More... | |
def | pattern_completion (self, test_data, view=0, verbose=False, visualiseInfo=None, optimise=100) |
Recall novel events. More... | |
def | pattern_completion_inference (self, y, target_modality=-1) |
Pattern completion wrapper. More... | |
def | fantasy_memory (self, X, view=0) |
Generating novel outputs. More... | |
def | familiarity (self, Ytest, ytrmean=None, ytrstd=None, optimise=100) |
Familiarity testing. More... | |
def | __get_latent__ (self) |
Return number of latent dimensions. More... | |
Public Attributes | |
type | |
model | |
observed | |
inputs | |
Q | |
N | |
num_inducing | |
namesList | |
Ylist | |
def SAM.SAM_Core.SAMCore.LFM.__init__ | ( | self | ) |
Initalise the Latent Feature Models.
Definition at line 44 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.LFM.__get_latent__ | ( | self | ) |
Return number of latent dimensions.
None. |
Definition at line 472 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.LFM.add_labels | ( | self, | |
labels | |||
) |
Add labels to observations.
labels | list of strings containing the labels for the observations |
Definition at line 169 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.LFM.check_snr | ( | self, | |
warningEnable = True , |
|||
messages = True |
|||
) |
Checks the signal to noise ratio(SNR) of the trained model.
warningEnable | Boolean to switch warnings on or off in the case of a low SNR. |
messages | Boolean to turn output to stdout on or off. |
Definition at line 212 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.LFM.familiarity | ( | self, | |
Ytest, | |||
ytrmean = None , |
|||
ytrstd = None , |
|||
optimise = 100 |
|||
) |
Familiarity testing.
Ytest | A (Dx1) numpy array whose familiarity/similarity is tested with trained outputs of the model. |
ytrmean | A (Dx1) numpy array with the mean of the training inputs. |
ytrstd | A (Dx1) numpy array with the variance of the training inputs. |
optimise | Integer number of optimisation iterations when performing pattern completion. |
Definition at line 441 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.LFM.fantasy_memory | ( | self, | |
X, | |||
view = 0 |
|||
) |
Generating novel outputs.
X | A (Qx1) numpy array with the location of the Q dimensional model that is to be generated. |
view | Integer which is the index for the view of the MRD model that will be used to generate the fantasy_memory. |
(Qx1)
numpy array with the predicted mean and a (Qx1)
numpy array with the predicted variance. Definition at line 418 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.LFM.learn | ( | self, | |
optimizer = 'bfgs' , |
|||
max_iters = 1000 , |
|||
init_iters = 300 , |
|||
verbose = True |
|||
) |
Learn the model (analogous to "forming synapses" after perceiving data).
optimizer | String with the requested optimiser taken from a the list of available scipy optimisers. |
max_iters | Integer with the maximum number of training iterations for the second phase of training the model. |
init_iters | Integer with the maximum number of training iterations for the first phase of training. |
verbose | Boolean to turn logging to stdout on or off. |
Definition at line 188 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.LFM.pattern_completion | ( | self, | |
test_data, | |||
view = 0 , |
|||
verbose = False , |
|||
visualiseInfo = None , |
|||
optimise = 100 |
|||
) |
Recall novel events.
test_data | A (Dx1) numpy array containing the feature vector for which you would like to obtain the closest neighbour. |
view | Integer which is the index for the view of the MRD model that will be used for pattern completion. |
verbose | Boolean switching logging to stdout on and off. |
visualiseInfo | Plot object returned by visualiseInfo. If present, plot the location of the pattern completed point. If none, no plotting. |
optimise | Integer number of optimisation iterations when performing pattern completion. |
(Qx1)
numpy array with the predicted mean, a (Qx1)
numpy array with the predicted variance, a plot object with plotted point and an inference object returned by optimiser. Definition at line 347 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.LFM.pattern_completion_inference | ( | self, | |
y, | |||
target_modality = -1 |
|||
) |
Pattern completion wrapper.
y | A (Dx1) numpy array containing the feature vector for which you would like to obtain the closest neighbour. |
target_modality | Integer which is the index for the view of the MRD model that will be used for pattern completion. |
Definition at line 390 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.LFM.recall | ( | self, | |
locations | |||
) |
Recall stored events.
locations | Integer which is the index of the stored event. |
(Dx1)
numpy array containing the data of a training point as reconstructed by the model. Definition at line 324 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.LFM.store | ( | self, | |
observed, | |||
inputs = None , |
|||
Q = None , |
|||
kernel = None , |
|||
num_inducing = None , |
|||
init_X = 'PCA' |
|||
) |
Store events.
observed | An (N x D) matrix, where N is the number of points and D the number of features needed to describe each point. |
inputs | A (N x Q) matrix, where Q is the number of features per input. Leave "None" for unsupervised learning. |
Q | Leave None for supervised learning (Q will then be the dimensionality of inputs). Otherwise, specify with an integer Q the dimensionality (number of features) for the compressed space that acts as "latent" inputs. |
kernel | For the GP. Can be left as "None" for the default kernel. |
num_inducing | Integer of how many inducing points to use. Inducing points are a fixed number of variables through which all memory is filtered, to achieve full compression. E.g. it can correspond to the number of neurons. This is not absolutely fixed, but it also doesn't grow necessarily proportionally to the data, since synapses can make more complicated combinations of the existing neurons. The GP is here playing the role of "synapses", by learning non-linear and rich combinations of the inducing points. |
init_X | Initialisation method for model output. String either PCA or PPCA . Default= PCA . Initialisation uses PPCA when PCA |
Definition at line 72 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.LFM.visualise | ( | self, | |
which_indices = None , |
|||
plot_scales = True |
|||
) |
Show the internal representation of the memory.
which_indices | Tuple of two integers that specify which indices of the Q indices that make up the model are to be plotted. |
plot_scales | Boolean to switch scale labelling on or off in the plots. |
Definition at line 245 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.LFM.visualise_interactive | ( | self, | |
dimensions = (20, 28) , |
|||
transpose = True , |
|||
order = 'F' , |
|||
invert = False , |
|||
scale = False , |
|||
colorgray = True , |
|||
view = 0 , |
|||
which_indices = (0, 1) |
|||
) |
Interactive plot of the model.
dimensions | Tuple of integers describing the dimensions that the image needs to be transposed to for display. |
transpose | Boolean whether to transpose the image before display. |
order | Boolean whether array is in Fortan ordering ('F') or Python ordering ('C'). |
invert | Boolean whether to invert the pixels or not. |
scale | Boolean whether to scale the image or not. |
colorgray | Boolean whether to plot in grayscale or not. |
view | Integer in the case of MRD models which describes the view to be plotted. |
which_indices | Tuple of two integers that specify which indices of the Q indices that make up the model are to be plotted. |
Definition at line 286 of file SAMCore.py.
SAM.SAM_Core.SAMCore.LFM.inputs |
Definition at line 48 of file SAMCore.py.
SAM.SAM_Core.SAMCore.LFM.model |
Definition at line 46 of file SAMCore.py.
SAM.SAM_Core.SAMCore.LFM.N |
Definition at line 51 of file SAMCore.py.
SAM.SAM_Core.SAMCore.LFM.namesList |
Definition at line 53 of file SAMCore.py.
SAM.SAM_Core.SAMCore.LFM.num_inducing |
Definition at line 52 of file SAMCore.py.
SAM.SAM_Core.SAMCore.LFM.observed |
Definition at line 47 of file SAMCore.py.
SAM.SAM_Core.SAMCore.LFM.Q |
Definition at line 50 of file SAMCore.py.
SAM.SAM_Core.SAMCore.LFM.type |
Definition at line 45 of file SAMCore.py.
SAM.SAM_Core.SAMCore.LFM.Ylist |
Definition at line 54 of file SAMCore.py.
class SAM::SAM_Core::samOptimiser::modelOptClass |
Class to perform optimisation of SAM Models.
This class reads in the parameters for optimisation from the [Optimisation]
section found in the config.ini present in the data directory passed in as dataDir. Parameters are set for variables that are present in the [driver_name]
section of the same config.ini in the following manner variableName = [parameterType:commaSeparatedParameterValues]
.
Parameters can be :
1) discreteInt : Equally spaced integers in the form of x = [discreteInt:start,interval,end]
.
2) discreteFloat : Equally spaced floats in the form of x = [discreteFloat:start,interval,end]
.
3) continuous : Continuous range in the form of x = [continuous:start,end]
.
4) list : Use one parameter value at a time from the comma separated list of possible parameter values in the form of x = [list:a,b,c,d]
where x is set to just one of the values in the list.
5) bool : In the form of x = [bool]
where x = 1 or 0. Similar to x = [list:1,0]
.
6) combination : Use multiple parameters at a time from the comma separated list of possible parameters values in the form of x = [combination:a,b,c,d]
where x is set to a combination of parameters. Length of the values list in x ranges from 1 to number of comma separated parameter values.
Examples
Definition at line 91 of file samOptimiser.py.
Public Member Functions | |
def | __init__ (self, fName, dataDir, modelDir, driverName, mode, baseName, persistence, windowed, verbose) |
Initialisation for modelOptClass. More... | |
def | configOptimisation (self) |
Configure optimisation parameters from config.ini. More... | |
def | f (self, x) |
Optimisation Evaluation Function. More... | |
def | copyModel (self, newName, direction) |
Utility function to copy model. More... | |
Public Attributes | |
fName | |
dataDir | |
modelDir | |
driverName | |
baseName | |
persistence | |
verbose | |
devnull | |
windowed | |
numEvals | |
penalty | |
mode | |
parser | |
sectionBackup | |
sectionOpt | |
modelPresent | |
bestOptions | |
domain | |
bestError | |
currIterSettings | |
acquisitionFunction | |
trainProcess | |
resultsList | |
currFiles | |
configured | |
numPossibilities | |
def SAM.SAM_Core.samOptimiser.modelOptClass.__init__ | ( | self, | |
fName, | |||
dataDir, | |||
modelDir, | |||
driverName, | |||
mode, | |||
baseName, | |||
persistence, | |||
windowed, | |||
verbose | |||
) |
Initialisation for modelOptClass.
fName | File name of the model to use as a starting point for the optimisation |
dataDir | Directory containing the data to be trained |
modelDir | Directory where to save optimised model and temporary models created during optimisation |
driverName | Name of driver to use for training which must be present in SAM_Drivers folder |
mode | This is a legacy parameter that changed the behaviour of saving models. This parameter is not in use anymore. |
baseName | Base name of model to be trained. Model filenames take the form of baseName_driverName_modelType_modelVersion.pickle with a corresponding baseName_driverName_modelType_modelVersion_model.h5. modelVersion can be best , exp<experiment number> , or backup . |
persistence | 'True' or 'False' indicating terminals opened by samOptimiser stay open even after process termination |
windowed | 'True' or 'False' indicating separate terminals will be opened by samOptimiser for each training and interaction process |
verbose | 'True' or 'False' switching on or off logging to stdout |
Definition at line 109 of file samOptimiser.py.
def SAM.SAM_Core.samOptimiser.modelOptClass.configOptimisation | ( | self | ) |
Configure optimisation parameters from config.ini.
Reads in config.ini parameters and sets up the optimisation landscape from these parameters. Also reads in the performance of a current model if one is available to set that as the performance to beat.
Definition at line 153 of file samOptimiser.py.
def SAM.SAM_Core.samOptimiser.modelOptClass.copyModel | ( | self, | |
newName, | |||
direction | |||
) |
Utility function to copy model.
newName | Model base name to copy. |
direction | normal or reverse . normal makes a copy of the model with exp<experiment number> in the filename to backup in the filename. reverse makes a copy of backup into exp<experiment number> . |
Definition at line 427 of file samOptimiser.py.
def SAM.SAM_Core.samOptimiser.modelOptClass.f | ( | self, | |
x | |||
) |
Optimisation Evaluation Function.
This function evaluates the current values chosen by the optimiser in x
by writing these parameter values to the respective parameters in the training parameters section of the config.ini and subsequently making a system call to trainSAMModel.
x | List of current evaluation parameters chosen by the optimiser. |
Definition at line 304 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.acquisitionFunction |
Definition at line 134 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.baseName |
Definition at line 116 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.bestError |
Definition at line 132 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.bestOptions |
Definition at line 130 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.configured |
Definition at line 138 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.currFiles |
Definition at line 137 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.currIterSettings |
Definition at line 133 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.dataDir |
Definition at line 113 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.devnull |
Definition at line 119 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.domain |
Definition at line 131 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.driverName |
Definition at line 115 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.fName |
Definition at line 112 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.mode |
Definition at line 125 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.modelDir |
Definition at line 114 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.modelPresent |
Definition at line 129 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.numEvals |
Definition at line 123 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.numPossibilities |
Definition at line 202 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.parser |
Definition at line 126 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.penalty |
Definition at line 124 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.persistence |
Definition at line 117 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.resultsList |
Definition at line 136 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.sectionBackup |
Definition at line 127 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.sectionOpt |
Definition at line 128 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.trainProcess |
Definition at line 135 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.verbose |
Definition at line 118 of file samOptimiser.py.
SAM.SAM_Core.samOptimiser.modelOptClass.windowed |
Definition at line 120 of file samOptimiser.py.
class SAM::SAM_Core::samSupervisor::SamSupervisorModule |
Model management and supervisor.
default.ini
in samSupervisor
context folder which contains the configuration details for samSupervisor as seen in the example below.Examples
root_path | Path to folder containing Data and Models folders. |
config_path | Name of configuration file detailing parameters for different drivers. |
persistence | 'True' or 'False' indicating terminals opened by samSupervisor stay open even after process termination. |
windowed | 'True' or 'False' indicating separate terminals will be opened by samSupervisor for each training and interaction process. |
verbose | 'True' or 'False' switching on or off logging to stdout. |
useOPC | 'True' or 'False' indicating using or not using OPC for further information. |
startModels | 'True' or 'False' indicating all models in the config_path file will be automatically loaded during samSupervisor startup. |
acceptableDelay | String with an integer for the number of tries before a model is declared dead, aborted and restarted. |
controllerIP | IP address for the ipyparallel controller. Currently not in use. Leave at 127.0.0.1. |
Definition at line 55 of file samSupervisor.py.
Public Member Functions | |
def | __init__ (self) |
def | configure (self, rf) |
Configure interactionSAMModel Yarp module. More... | |
def | close (self) |
Close Yarp module. More... | |
def | checkAvailabilities (self, reply) |
Check model availabilities. More... | |
def | respond (self, command, reply) |
Respond to external requests. More... | |
def | forwardCommand (self, command, reply) |
Helper function to forward a call sign to the respective model with an enforced timeout of 10 seconds for the reply so the module does not hang. More... | |
def | interruptModule (self) |
Module interrupt logic. More... | |
def | listModels (self, reply, command) |
Returns lists of models for train or interaction categpories. More... | |
def | attentionModulation (self, reply, command) |
Modulate attention of all models. More... | |
def | askOPC (self, reply) |
Query the OPC for additional contextual data. More... | |
def | closeModel (self, reply, command, external=False) |
Close a loaded model. More... | |
def | loadModel (self, reply, command) |
Load a trained model. More... | |
def | checkModel (self, reply, command, allCheck=False) |
Check availability and status of a model. More... | |
def | train (self, reply, command) |
Logic for training a model. More... | |
def | optimise (self, reply, command) |
Logic for optimising a model. More... | |
def | deleteModel (self, reply, command) |
Deletes model from hard disk. More... | |
def | configModel (self, reply, command) |
Displays the model configuration file using a system call to gedit. More... | |
def | dataDirModel (self, reply, command) |
Returns the chosen model. More... | |
def | reportModel (self, reply, command) |
Returns the performance of the trained model. More... | |
def | train_model (self, mod) |
Train a model. More... | |
def | optimise_model (self, mod, modName) |
Optimise a model. More... | |
def | getPeriod (self) |
Module refresh rate. More... | |
def | onlineModelCheck (self) |
Check status of loaded models. More... | |
def | checkOperation (self, j) |
Check heartbeat of model. More... | |
def | updateModule (self) |
Logic to execute every getPeriod() seconds. More... | |
Public Attributes | |
SIGNALS_TO_NAMES_DICT | |
terminal | |
rootPath | |
interactionConfPath | |
startModels | |
persistence | |
windowed | |
verbose | |
modelPath | |
dataPath | |
trainingFunctionsPath | |
trainingListHandles | |
loadedListHandles | |
iter | |
rpcConnections | |
inputBottle | |
sendingBottle | |
responseBottle | |
outputBottle | |
devnull | |
supervisorPort | |
interactionConfFile | |
interactionParser | |
interactionSectionList | |
cluster | |
functionsList | |
trainableModels | |
modelsList | |
updateModels | |
updateModelsNames | |
noModels | |
noModelsNames | |
uptodateModels | |
uptodateModelsNames | |
nonResponsiveDict | |
nonResponsiveThreshold | |
modelConnections | |
connectionCheckCount | |
modelPriority | |
opcPort | |
useOPC | |
attentionModes | |
opcPortName | |
opcRPCName | |
baseLogFileName | |
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.__init__ | ( | self | ) |
Definition at line 56 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.askOPC | ( | self, | |
reply | |||
) |
Query the OPC for additional contextual data.
reply | Yarp bottle for the reply from OPC. |
Definition at line 767 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.attentionModulation | ( | self, | |
reply, | |||
command | |||
) |
Modulate attention of all models.
command | Yarp bottle with command. Example valid commands below. |
reply | Yarp bottle for the reply from the model. |
Definition at line 737 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.checkAvailabilities | ( | self, | |
reply | |||
) |
Check model availabilities.
root_path/Models
. Then cross checks that the corresponding data folder exists in root_path/Data
and that it contains an appropriate config.ini
file. If a data folder exists but a model does not, this is added to noModels list. If the folder and the model both exist and the modification date of the data is newer than that of the model it is added to updateModels (requiring an update) if the modification date of the model is newer it is added to uptodateModels. If the model exists but not the data folder config file, the model is ignored. Each model and data folder pair is then paired with its respective driver from the SAM_Drivers folder. If a corresponding driver is not available, the data and model are ignored.reply | Yarp Bottle containing a many string formatted response to indicate the state of all the available drivers and the corresponding models. |
Definition at line 366 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.checkModel | ( | self, | |
reply, | |||
command, | |||
allCheck = False |
|||
) |
Check availability and status of a model.
reply | Yarp bottle for the reply from the function. |
command | Yarp bottle with the command and the model name to check. |
allCheck | Boolean to check all models if True and check a single model if False. |
Definition at line 1092 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.checkOperation | ( | self, | |
j | |||
) |
Check heartbeat of model.
j | Yarp rpc port for loaded model to check. |
ack
to a hartbeat
request. Definition at line 1700 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.close | ( | self | ) |
Close Yarp module.
EXIT
command to all loaded interaction modules. Terminates training processes. Closes samSupervisor ports and terminates cluster if one has been started.None |
Definition at line 328 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.closeModel | ( | self, | |
reply, | |||
command, | |||
external = False |
|||
) |
Close a loaded model.
reply | Yarp bottle for the reply from the function. |
command | Yarp bottle with the command and the model name to close. |
external | Boolean indicating model to be closed is to be closed for good if True . Else model is to be closed for restart. |
Definition at line 839 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.configModel | ( | self, | |
reply, | |||
command | |||
) |
Displays the model configuration file using a system call to gedit.
reply | Yarp bottle for the reply from the function. |
command | Yarp bottle with the command and the model name to display. |
Definition at line 1274 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.configure | ( | self, | |
rf | |||
) |
Configure interactionSAMModel Yarp module.
rf | Yarp RF context input. |
Definition at line 113 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.dataDirModel | ( | self, | |
reply, | |||
command | |||
) |
Returns the chosen model.
best
indicates the best performing model. exp
indicates the last trained model. backup
indicates the model present before optimisation started. The priority of suffixes is best
, exp
, backup
.reply | Yarp bottle for the reply from the function. |
command | Yarp bottle with the command and the model name to chose. |
Definition at line 1307 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.deleteModel | ( | self, | |
reply, | |||
command | |||
) |
Deletes model from hard disk.
reply | Yarp bottle for the reply from the function. |
command | Yarp bottle with the command and the model name to delete. |
Definition at line 1202 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.forwardCommand | ( | self, | |
command, | |||
reply | |||
) |
Helper function to forward a call sign to the respective model with an enforced timeout of 10 seconds for the reply so the module does not hang.
command | Yarp bottle with the call sign. |
reply | Yarp bottle for the reply from the model. |
Definition at line 669 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.getPeriod | ( | self | ) |
Module refresh rate.
Returns The period of the module in seconds.
Definition at line 1568 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.interruptModule | ( | self | ) |
Module interrupt logic.
Returns Boolean indicating success of logic or not.
Definition at line 679 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.listModels | ( | self, | |
reply, | |||
command | |||
) |
Returns lists of models for train or interaction categpories.
command | Yarp bottle with command. Example valid commands below. |
reply | Yarp bottle for the reply from the model. |
Definition at line 697 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.loadModel | ( | self, | |
reply, | |||
command | |||
) |
Load a trained model.
reply | Yarp bottle for the reply from the function. |
command | Yarp bottle with the command and the model name to load. |
Definition at line 886 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.onlineModelCheck | ( | self | ) |
Check status of loaded models.
None |
Definition at line 1581 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.optimise | ( | self, | |
reply, | |||
command | |||
) |
Logic for optimising a model.
reply | Yarp bottle for the reply from the function. |
command | Yarp bottle with the command and the model name to optimise. |
Definition at line 1167 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.optimise_model | ( | self, | |
mod, | |||
modName | |||
) |
Optimise a model.
mod | Model information. |
modName | Model name. |
Definition at line 1502 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.reportModel | ( | self, | |
reply, | |||
command | |||
) |
Returns the performance of the trained model.
reply | Yarp bottle for the reply from the function. |
command | Yarp bottle with the command, the model name to report and a plot parameter to switch plot on or off. |
Examples
report <modelName>
Definition at line 1363 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.respond | ( | self, | |
command, | |||
reply | |||
) |
Respond to external requests.
continue
. Disable classification if is stop
. Calls attentionModulation() plot
. Return a formatted confusion matrix if <plotFlag> is not plot
. Calls reportModel()ask_X_label
and ask_X_instance
call signs for all models that are currently loaded with interactionSAMModel.pynack
. nack
. command | Incoming Yarp bottle containing external request. |
reply | Outgoing Yarp bottle containing reply to processed request. |
Definition at line 580 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.train | ( | self, | |
reply, | |||
command | |||
) |
Logic for training a model.
reply | Yarp bottle for the reply from the function. |
command | Yarp bottle with the command and the model name to train. |
Definition at line 1130 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.train_model | ( | self, | |
mod | |||
) |
Train a model.
mod | String with the model name to load. |
Definition at line 1422 of file samSupervisor.py.
def SAM.SAM_Core.samSupervisor.SamSupervisorModule.updateModule | ( | self | ) |
Logic to execute every getPeriod() seconds.
Returns Boolean indicating success of logic or not.
Definition at line 1718 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.attentionModes |
Definition at line 99 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.baseLogFileName |
Definition at line 102 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.cluster |
Definition at line 82 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.connectionCheckCount |
Definition at line 95 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.dataPath |
Definition at line 67 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.devnull |
Definition at line 77 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.functionsList |
Definition at line 83 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.inputBottle |
Definition at line 73 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.interactionConfFile |
Definition at line 79 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.interactionConfPath |
Definition at line 61 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.interactionParser |
Definition at line 80 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.interactionSectionList |
Definition at line 81 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.iter |
Definition at line 71 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.loadedListHandles |
Definition at line 70 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.modelConnections |
Definition at line 94 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.modelPath |
Definition at line 66 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.modelPriority |
Definition at line 96 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.modelsList |
Definition at line 85 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.noModels |
Definition at line 88 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.noModelsNames |
Definition at line 89 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.nonResponsiveDict |
Definition at line 92 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.nonResponsiveThreshold |
Definition at line 93 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.opcPort |
Definition at line 97 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.opcPortName |
Definition at line 100 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.opcRPCName |
Definition at line 101 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.outputBottle |
Definition at line 76 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.persistence |
Definition at line 63 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.responseBottle |
Definition at line 75 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.rootPath |
Definition at line 60 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.rpcConnections |
Definition at line 72 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.sendingBottle |
Definition at line 74 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.SIGNALS_TO_NAMES_DICT |
Definition at line 58 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.startModels |
Definition at line 62 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.supervisorPort |
Definition at line 78 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.terminal |
Definition at line 59 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.trainableModels |
Definition at line 84 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.trainingFunctionsPath |
Definition at line 68 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.trainingListHandles |
Definition at line 69 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.updateModels |
Definition at line 86 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.updateModelsNames |
Definition at line 87 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.uptodateModels |
Definition at line 90 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.uptodateModelsNames |
Definition at line 91 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.useOPC |
Definition at line 98 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.verbose |
Definition at line 65 of file samSupervisor.py.
SAM.SAM_Core.samSupervisor.SamSupervisorModule.windowed |
Definition at line 64 of file samSupervisor.py.
class SAM::SAM_Core::svi_ratio::SVI_Ratio |
Inference the marginal likelihood through {p(y,y*)}{p(y)}.
Definition at line 23 of file svi_ratio.py.
Public Member Functions | |
def | __init__ (self, mpi_comm=None) |
def | get_trYYT (self, Y) |
def | get_YYTfactor (self, Y) |
def | gatherPsiStat (self, kern, X, Z, Y, beta, uncertain_inputs, D, missing_data) |
def | inference (self, kern, X, Z, likelihood, Y, qU) |
The SVI-VarDTC inference. More... | |
Public Attributes | |
mpi_comm | |
Static Public Attributes | |
int | const_jitter = 1e-6 |
def SAM.SAM_Core.svi_ratio.SVI_Ratio.__init__ | ( | self, | |
mpi_comm = None |
|||
) |
Definition at line 25 of file svi_ratio.py.
def SAM.SAM_Core.svi_ratio.SVI_Ratio.gatherPsiStat | ( | self, | |
kern, | |||
X, | |||
Z, | |||
Y, | |||
beta, | |||
uncertain_inputs, | |||
D, | |||
missing_data | |||
) |
Definition at line 39 of file svi_ratio.py.
def SAM.SAM_Core.svi_ratio.SVI_Ratio.get_trYYT | ( | self, | |
Y | |||
) |
Definition at line 29 of file svi_ratio.py.
def SAM.SAM_Core.svi_ratio.SVI_Ratio.get_YYTfactor | ( | self, | |
Y | |||
) |
Definition at line 32 of file svi_ratio.py.
def SAM.SAM_Core.svi_ratio.SVI_Ratio.inference | ( | self, | |
kern, | |||
X, | |||
Z, | |||
likelihood, | |||
Y, | |||
qU | |||
) |
The SVI-VarDTC inference.
Definition at line 77 of file svi_ratio.py.
|
static |
Definition at line 24 of file svi_ratio.py.
SAM.SAM_Core.svi_ratio.SVI_Ratio.mpi_comm |
Definition at line 27 of file svi_ratio.py.
def SAM.SAM_Core.trainSAMModel.exception_hook | ( | exc_type, | |
exc_value, | |||
exc_traceback | |||
) |
Generic training function.
Generic training function that carries out SAM Model training on a collection of data, The parameters for training function are loaded from the config file present in the folder containing the data to be trained. An example of the configuration structure is shown in samOptimiser.modelOptClass Callback function to record any errors that occur in the log files.
exc_type | Exception Type. |
exc_value | Exception Value. |
exc_traceback | Exception Traceback. |
Definition at line 48 of file trainSAMModel.py.
def SAM.SAM_Core.SAMCore.load_model | ( | fileName = 'm_serialized.txt' | ) |
Load serialised model.
fileName | String with the filename of model to load. |
Definition at line 507 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.load_pruned_model | ( | fileName = 'm_pruned' , |
|
economy = False , |
|||
m = None |
|||
) |
Load a pruned model.
True
, then a not-None initial model m is needed. This model needs to be created exactly as the one that was saved (so, it is demo specific!) and in this case calling the present function will set its parameters (meaning that you still need to create a model but don't need to optimize it).fileName | String with the filename of the model to load. |
economy | Boolean to indicate whether an economy object is being loaded or not. |
m | Model object into which the data to be loaded is to be stored in. If left at None model will be loaded into a default model initialisation. |
Definition at line 583 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.most_significant_input_dimensions | ( | model | ) |
Determine the most descriptive output dimensions.
model | Model object to be assessed. |
Definition at line 628 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.save_model | ( | mm, | |
fileName = 'm_serialized.txt' |
|||
) |
Save serialised model.
mm | Model object to save. |
fileName | String with the filename of saved model. |
Definition at line 492 of file SAMCore.py.
def SAM.SAM_Core.SAMCore.save_pruned_model | ( | mm, | |
fileName = 'm_pruned' , |
|||
economy = False , |
|||
extraDict = dict() |
|||
) |
Save a pruned model.
True
will trigger a storing which creates much smaller files. See the load_pruned_model discussion on what this means in terms of restrictions.mm | Model object to save. |
fileName | String with the filename of saved model. |
economy | Boolean to enable or disable economy saving. |
extraDict | Dictionary with parameters that are requested to be saved which are not in the default saved parameters but are required when loading the model for interaction. |
Definition at line 526 of file SAMCore.py.