icub-client
|
Drivers folder containing driver classes that inherit from SAMDriver to implement custom functionality. More...
Namespaces | |
SAM.SAM_Core.samOptimiser | |
Classes | |
class | SAM.SAM_Core.SAMDriver.SAMDriver |
SAM Driver parent class that defines the methods by which models are initialised, trained and saved. More... | |
class | SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin |
Class developed for the implementation of windowed real time action recognition. More... | |
class | SAM.SAM_Drivers.SAMDriver_interaction.SAMDriver_interaction |
Class developed for the implementation of face recognition. More... | |
Functions | |
def | SAM.SAM_Core.SAMDriver.SAMDriver.__init__ (self) |
Initialisation for SAMDriver. More... | |
def | SAM.SAM_Core.SAMDriver.SAMDriver.loadParameters (self, parser, trainName) |
Function to load parameters from the model config.ini file. More... | |
def | SAM.SAM_Core.SAMDriver.SAMDriver.saveParameters (self) |
Method to store variables generated during training which are required during interaction in self.paramsDict. More... | |
def | SAM.SAM_Core.SAMDriver.SAMDriver.testPerformance (self, testModel, Yall, Lall, YtestAll, LtestAll, verbose) |
Method for testing the whole dataset for overall performance. More... | |
def | SAM.SAM_Core.SAMDriver.SAMDriver.training (self, modelNumInducing, modelNumIterations, modelInitIterations, fname, save_model, economy_save, keepIfPresent=True, kernelStr=None) |
Method to train, store and load the learned model. More... | |
def | SAM.SAM_Core.SAMDriver.SAMDriver.prepareData (self, model='mrd', Ntr=50, randSeed=0, normalise=True) |
Method for randomly splitting data and preparing Y dictionary. More... | |
def | SAM.SAM_Core.SAMDriver.SAMDriver.readData (self, root_data_dir, participant_index, args, kw) |
Method which accepts a data directory, reads all the data in and outputs self.Y which is a numpy array with n instances of m length feature vectors and self.L which is a list of text Labels of length n. More... | |
def | SAM.SAM_Core.SAMDriver.SAMDriver.processLiveData (self, dataList, thisModel, verbose=False) |
Method which receives a list of data frames and outputs a classification if available or 'no_classification' if it is not. More... | |
def | SAM.SAM_Core.SAMDriver.SAMDriver.formatGeneratedData (self, instance) |
Method which receives an instance generated from a model via a label and formats the received vector by reshaping it or adding crucial data with it for it to be deciphered at the receiving end. More... | |
Drivers folder containing driver classes that inherit from SAMDriver to implement custom functionality.
class SAM::SAM_Core::SAMDriver::SAMDriver |
SAM Driver parent class that defines the methods by which models are initialised, trained and saved.
Definition at line 35 of file SAMDriver.py.
Public Member Functions | |
def | __init__ (self) |
Initialisation for SAMDriver. More... | |
def | loadParameters (self, parser, trainName) |
Function to load parameters from the model config.ini file. More... | |
def | saveParameters (self) |
Method to store variables generated during training which are required during interaction in self.paramsDict. More... | |
def | testPerformance (self, testModel, Yall, Lall, YtestAll, LtestAll, verbose) |
Method for testing the whole dataset for overall performance. More... | |
def | training (self, modelNumInducing, modelNumIterations, modelInitIterations, fname, save_model, economy_save, keepIfPresent=True, kernelStr=None) |
Method to train, store and load the learned model. More... | |
def | prepareData (self, model='mrd', Ntr=50, randSeed=0, normalise=True) |
Method for randomly splitting data and preparing Y dictionary. More... | |
def | readData (self, root_data_dir, participant_index, args, kw) |
Method which accepts a data directory, reads all the data in and outputs self.Y which is a numpy array with n instances of m length feature vectors and self.L which is a list of text Labels of length n. More... | |
def | processLiveData (self, dataList, thisModel, verbose=False) |
Method which receives a list of data frames and outputs a classification if available or 'no_classification' if it is not. More... | |
def | formatGeneratedData (self, instance) |
Method which receives an instance generated from a model via a label and formats the received vector by reshaping it or adding crucial data with it for it to be deciphered at the receiving end. More... | |
Public Attributes | |
SAMObject | |
Y | |
L | |
X | |
Ytest | |
Ltest | |
Ytestn | |
Ltestn | |
Ymean | |
Ystd | |
Yn | |
Ln | |
segTrainConf | |
segTrainPerc | |
segTestConf | |
segTestPerc | |
data_labels | |
paramsDict | |
verbose | |
model_mode | |
Quser | |
listOfModels | |
model_type | |
modelLabel | |
textLabels | |
participantList | |
varianceThreshold | |
fname | |
optimiseRecall | |
modelLoaded | |
parallelOperation | |
calibrated | |
rawTextData | |
rawData | |
Yall | |
Lall | |
YtestAll | |
LtestAll | |
classifiers | |
classif_thresh | |
model_num_inducing | |
model_num_iterations | |
model_init_iterations | |
additionalParametersList | |
class SAM::SAM_Drivers::SAMDriver_ARWin::SAMDriver_ARWin |
Class developed for the implementation of windowed real time action recognition.
Definition at line 28 of file SAMDriver_ARWin.py.
Public Member Functions | |
def | __init__ (self) |
Initialise class using SAMDriver.__init__ and augment with custom parameters. More... | |
def | loadParameters (self, parser, trainName) |
Function to load parameters from the model config.ini file. More... | |
def | saveParameters (self) |
Override SAMDriver.saveParameters. More... | |
def | testPerformance (self, testModel, Yall, Lall, YtestAll, LtestAll, verbose) |
Custom testPerformance method. More... | |
def | diskDataToLiveData (self, root_data_dir) |
This method reads in time series data from disk for SAMDriver_ARWin. More... | |
def | convertToDict (self, rawData, mode, verbose) |
Convert list of strings time series to dictionary with joints and objects as different items of the dictionary and windows of positions for each joint. More... | |
def | readData (self, root_data_dir, participant_index, args, kw) |
Method which accepts a data directory, reads all the data in and outputs self.Y which is a numpy array with n instances of m length feature vectors and self.L which is a list of text Labels of length n. More... | |
def | listOfClassificationVectors (self, featureSequence, objectsList, partnerName='partner') |
Constructs a list of classifications to carry out. More... | |
def | messageChecker (self, dataMessage, mode) |
Method to check validity of incoming messages and split into components if valid. More... | |
def | processLiveData (self, dataList, thisModel, verbose=False, returnUnknown=False, printClass=True, additionalData=dict()) |
Method which receives a list of data frames and outputs a classification if available or 'no_classification' if it is not. More... | |
Public Member Functions inherited from SAM.SAM_Core.SAMDriver.SAMDriver | |
def | __init__ (self) |
Initialisation for SAMDriver. More... | |
def | loadParameters (self, parser, trainName) |
Function to load parameters from the model config.ini file. More... | |
def | saveParameters (self) |
Method to store variables generated during training which are required during interaction in self.paramsDict. More... | |
def | testPerformance (self, testModel, Yall, Lall, YtestAll, LtestAll, verbose) |
Method for testing the whole dataset for overall performance. More... | |
def | training (self, modelNumInducing, modelNumIterations, modelInitIterations, fname, save_model, economy_save, keepIfPresent=True, kernelStr=None) |
Method to train, store and load the learned model. More... | |
def | prepareData (self, model='mrd', Ntr=50, randSeed=0, normalise=True) |
Method for randomly splitting data and preparing Y dictionary. More... | |
def | readData (self, root_data_dir, participant_index, args, kw) |
Method which accepts a data directory, reads all the data in and outputs self.Y which is a numpy array with n instances of m length feature vectors and self.L which is a list of text Labels of length n. More... | |
def | processLiveData (self, dataList, thisModel, verbose=False) |
Method which receives a list of data frames and outputs a classification if available or 'no_classification' if it is not. More... | |
def | formatGeneratedData (self, instance) |
Method which receives an instance generated from a model via a label and formats the received vector by reshaping it or adding crucial data with it for it to be deciphered at the receiving end. More... | |
Public Attributes | |
data | |
numJoints | |
dataLogList | |
labelsLogList | |
itemsPerJoint | |
featureSequence | |
handsCombined | |
data2Labels | |
dataVec | |
allDataDict | |
listOfVectorsToClassify | |
seqTestConf | |
seqTestPerc | |
additionalParametersList | |
rawTextData | |
Y | |
L | |
Public Attributes inherited from SAM.SAM_Core.SAMDriver.SAMDriver | |
SAMObject | |
Y | |
L | |
X | |
Ytest | |
Ltest | |
Ytestn | |
Ltestn | |
Ymean | |
Ystd | |
Yn | |
Ln | |
segTrainConf | |
segTrainPerc | |
segTestConf | |
segTestPerc | |
data_labels | |
paramsDict | |
verbose | |
model_mode | |
Quser | |
listOfModels | |
model_type | |
modelLabel | |
textLabels | |
participantList | |
varianceThreshold | |
fname | |
optimiseRecall | |
modelLoaded | |
parallelOperation | |
calibrated | |
rawTextData | |
rawData | |
Yall | |
Lall | |
YtestAll | |
LtestAll | |
classifiers | |
classif_thresh | |
model_num_inducing | |
model_num_iterations | |
model_init_iterations | |
additionalParametersList | |
def SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.__init__ | ( | self | ) |
Initialise class using SAMDriver.__init__ and augment with custom parameters.
additionalParameterList is a list of extra parameters to preserve between training and interaction.
Definition at line 34 of file SAMDriver_ARWin.py.
def SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.convertToDict | ( | self, | |
rawData, | |||
mode, | |||
verbose | |||
) |
Convert list of strings time series to dictionary with joints and objects as different items of the dictionary and windows of positions for each joint.
rawData | List of strings read in from files. |
mode | 'testing' or 'live' . 'testing' will format strings read from file. 'live' will format strings received via Yarp during interaction. |
verbose | Switch logging to stdout on or off. |
Definition at line 272 of file SAMDriver_ARWin.py.
def SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.diskDataToLiveData | ( | self, | |
root_data_dir | |||
) |
This method reads in time series data from disk for SAMDriver_ARWin.
Definition at line 198 of file SAMDriver_ARWin.py.
def SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.listOfClassificationVectors | ( | self, | |
featureSequence, | |||
objectsList, | |||
partnerName = 'partner' |
|||
) |
Constructs a list of classifications to carry out.
Consider an example where featureSequence consists of `object', 'hand', 'head'. Assuming there are 2 objects in the scene, this method constructs 4 possible vectors to classify.
1) object1, rightHand, head
2) object1, leftHand, head
3) object2, rightHand, head
4) object2, leftHand, head
featureSequence | Organisation of features within the feature vector. |
objectsList | List of objects currently in the scene. |
partnerName | Object name to ignore. This ignores the motion of the interacting agent. |
Definition at line 763 of file SAMDriver_ARWin.py.
def SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.loadParameters | ( | self, | |
parser, | |||
trainName | |||
) |
Function to load parameters from the model config.ini file.
Method to load parameters from file loaded in parser from within section trainName and store these parameters in self.paramsDict.
parser | SafeConfigParser with pre-read config file. |
trainName | Section from which parameters are to be read. |
Definition at line 65 of file SAMDriver_ARWin.py.
def SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.messageChecker | ( | self, | |
dataMessage, | |||
mode | |||
) |
Method to check validity of incoming messages and split into components if valid.
dataMessage | String message to validate. |
mode | Mode of validation. Either 'test' or 'live' . |
Definition at line 800 of file SAMDriver_ARWin.py.
def SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.processLiveData | ( | self, | |
dataList, | |||
thisModel, | |||
verbose = False , |
|||
returnUnknown = False , |
|||
printClass = True , |
|||
additionalData = dict() |
|||
) |
Method which receives a list of data frames and outputs a classification if available or 'no_classification' if it is not.
dataList | List of dataFrames collected. Length of list is variable. |
thisModel | List of models required for testing. |
verbose | Boolean turning logging to stdout on or off. |
returnUnknown | Boolean to turn on or off the return a sentence if the classification is unknown. |
printClass | Boolean to turn on or off logging of classification to stdout. |
additionalData | Dictionary containing additional data required for classification to occur. |
'None'
if the classification is unknown or message is invalid or None
if a different error occurs. Definition at line 851 of file SAMDriver_ARWin.py.
def SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.readData | ( | self, | |
root_data_dir, | |||
participant_index, | |||
args, | |||
kw | |||
) |
Method which accepts a data directory, reads all the data in and outputs self.Y which is a numpy array with n instances of m length feature vectors and self.L which is a list of text Labels of length n.
This method reads data<number>.log files and the corresponding labels<number>.log files present in the root_data_dir and formats the time series data into normalised and smoothed windows. Subsequently depending on the list of joints chosen by the user and other parameters set in the config file present in the root_data_dir, the information of the different joints and objects are appended into a single feature vector. Number of feature vectors is equal to the number of windows extracted from the time series data.
root_data_dir | Data directory. |
participant_index | List of subfolders to consider. Can be left as an empty list. |
Definition at line 417 of file SAMDriver_ARWin.py.
def SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.saveParameters | ( | self | ) |
Override SAMDriver.saveParameters.
This function adds items of additionalParametersList to paramsDict to be saved.
Definition at line 153 of file SAMDriver_ARWin.py.
def SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.testPerformance | ( | self, | |
testModel, | |||
Yall, | |||
Lall, | |||
YtestAll, | |||
LtestAll, | |||
verbose | |||
) |
Custom testPerformance method.
This augments the standard testPerformance method by including testing of known and unknown together with testing on known training points and known testing points.
testModel | SAMObject Model to be tested. |
Yall | Numpy array with training data vectors to be tested. |
Lall | List with corresponding training data labels. |
YtestAll | Numpy array with testing data vectors to be tested. |
LtestAll | List with corresponding testing data labels. |
verbose | Boolean turning logging to stdout on or off. |
Definition at line 176 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.additionalParametersList |
Definition at line 49 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.allDataDict |
Definition at line 45 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.data |
Definition at line 36 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.data2Labels |
Definition at line 43 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.dataLogList |
Definition at line 38 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.dataVec |
Definition at line 44 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.featureSequence |
Definition at line 41 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.handsCombined |
Definition at line 42 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.itemsPerJoint |
Definition at line 40 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.L |
Definition at line 740 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.labelsLogList |
Definition at line 39 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.listOfVectorsToClassify |
Definition at line 46 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.numJoints |
Definition at line 37 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.rawTextData |
Definition at line 208 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.seqTestConf |
Definition at line 47 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.seqTestPerc |
Definition at line 48 of file SAMDriver_ARWin.py.
SAM.SAM_Drivers.SAMDriver_ARWin.SAMDriver_ARWin.Y |
Definition at line 739 of file SAMDriver_ARWin.py.
class SAM::SAM_Drivers::SAMDriver_interaction::SAMDriver_interaction |
Class developed for the implementation of face recognition.
Definition at line 26 of file SAMDriver_interaction.py.
Public Member Functions | |
def | __init__ (self) |
Initialise class using SAMDriver.__init__ and augment with custom parameters. More... | |
def | loadParameters (self, parser, trainName) |
Function to load parameters from the model config.ini file. More... | |
def | saveParameters (self) |
Executes SAMDriver.saveParameters to save default parameters. More... | |
def | readData (self, root_data_dir, participant_index, args, kw) |
Method which accepts a data directory, reads all the data in and outputs self.Y which is a numpy array with n instances of m length feature vectors and self.L which is a list of text Labels of length n. More... | |
def | processLiveData (self, dataList, thisModel, verbose, additionalData=dict()) |
Method which receives a list of data frames and outputs a classification if available or 'no_classification' if it is not. More... | |
def | formatGeneratedData (self, instance) |
Method to transform a generated instance from the model into a Yarp formatted output. More... | |
Public Member Functions inherited from SAM.SAM_Core.SAMDriver.SAMDriver | |
def | __init__ (self) |
Initialisation for SAMDriver. More... | |
def | loadParameters (self, parser, trainName) |
Function to load parameters from the model config.ini file. More... | |
def | saveParameters (self) |
Method to store variables generated during training which are required during interaction in self.paramsDict. More... | |
def | testPerformance (self, testModel, Yall, Lall, YtestAll, LtestAll, verbose) |
Method for testing the whole dataset for overall performance. More... | |
def | training (self, modelNumInducing, modelNumIterations, modelInitIterations, fname, save_model, economy_save, keepIfPresent=True, kernelStr=None) |
Method to train, store and load the learned model. More... | |
def | prepareData (self, model='mrd', Ntr=50, randSeed=0, normalise=True) |
Method for randomly splitting data and preparing Y dictionary. More... | |
def | readData (self, root_data_dir, participant_index, args, kw) |
Method which accepts a data directory, reads all the data in and outputs self.Y which is a numpy array with n instances of m length feature vectors and self.L which is a list of text Labels of length n. More... | |
def | processLiveData (self, dataList, thisModel, verbose=False) |
Method which receives a list of data frames and outputs a classification if available or 'no_classification' if it is not. More... | |
def | formatGeneratedData (self, instance) |
Method which receives an instance generated from a model via a label and formats the received vector by reshaping it or adding crucial data with it for it to be deciphered at the receiving end. More... | |
Public Attributes | |
additionalParametersList | |
Y | |
L | |
Public Attributes inherited from SAM.SAM_Core.SAMDriver.SAMDriver | |
SAMObject | |
Y | |
L | |
X | |
Ytest | |
Ltest | |
Ytestn | |
Ltestn | |
Ymean | |
Ystd | |
Yn | |
Ln | |
segTrainConf | |
segTrainPerc | |
segTestConf | |
segTestPerc | |
data_labels | |
paramsDict | |
verbose | |
model_mode | |
Quser | |
listOfModels | |
model_type | |
modelLabel | |
textLabels | |
participantList | |
varianceThreshold | |
fname | |
optimiseRecall | |
modelLoaded | |
parallelOperation | |
calibrated | |
rawTextData | |
rawData | |
Yall | |
Lall | |
YtestAll | |
LtestAll | |
classifiers | |
classif_thresh | |
model_num_inducing | |
model_num_iterations | |
model_init_iterations | |
additionalParametersList | |
def SAM.SAM_Drivers.SAMDriver_interaction.SAMDriver_interaction.__init__ | ( | self | ) |
Initialise class using SAMDriver.__init__ and augment with custom parameters.
additionalParameterList is a list of extra parameters to preserve between training and interaction.
Definition at line 32 of file SAMDriver_interaction.py.
def SAM.SAM_Drivers.SAMDriver_interaction.SAMDriver_interaction.formatGeneratedData | ( | self, | |
instance | |||
) |
Method to transform a generated instance from the model into a Yarp formatted output.
instance | Feature vector returned during generation of a label. |
Definition at line 264 of file SAMDriver_interaction.py.
def SAM.SAM_Drivers.SAMDriver_interaction.SAMDriver_interaction.loadParameters | ( | self, | |
parser, | |||
trainName | |||
) |
Function to load parameters from the model config.ini file.
Method to load parameters from file loaded in parser from within section trainName and store these parameters in self.paramsDict.
parser | SafeConfigParser with pre-read config file. |
trainName | Section from which parameters are to be read. |
Definition at line 49 of file SAMDriver_interaction.py.
def SAM.SAM_Drivers.SAMDriver_interaction.SAMDriver_interaction.processLiveData | ( | self, | |
dataList, | |||
thisModel, | |||
verbose, | |||
additionalData = dict() |
|||
) |
Method which receives a list of data frames and outputs a classification if available or 'no_classification' if it is not.
dataList | List of dataFrames collected. Length of list is variable. |
thisModel | List of models required for testing. |
verbose | Boolean turning logging to stdout on or off. |
additionalData | Dictionary containing additional data required for classification to occur. |
'None'
if the classification is unknown or message is invalid or None
if a different error occurs. Definition at line 213 of file SAMDriver_interaction.py.
def SAM.SAM_Drivers.SAMDriver_interaction.SAMDriver_interaction.readData | ( | self, | |
root_data_dir, | |||
participant_index, | |||
args, | |||
kw | |||
) |
Method which accepts a data directory, reads all the data in and outputs self.Y which is a numpy array with n instances of m length feature vectors and self.L which is a list of text Labels of length n.
This method reads .ppm images from disk, converts the images to grayscale and serialises the data into a feature vector.
root_data_dir | Data directory. |
participant_index | List of subfolders to consider. Can be left as an empty list. |
Definition at line 104 of file SAMDriver_interaction.py.
def SAM.SAM_Drivers.SAMDriver_interaction.SAMDriver_interaction.saveParameters | ( | self | ) |
Executes SAMDriver.saveParameters to save default parameters.
Definition at line 88 of file SAMDriver_interaction.py.
SAM.SAM_Drivers.SAMDriver_interaction.SAMDriver_interaction.additionalParametersList |
Definition at line 34 of file SAMDriver_interaction.py.
SAM.SAM_Drivers.SAMDriver_interaction.SAMDriver_interaction.L |
Definition at line 199 of file SAMDriver_interaction.py.
SAM.SAM_Drivers.SAMDriver_interaction.SAMDriver_interaction.Y |
Definition at line 198 of file SAMDriver_interaction.py.
def SAM.SAM_Core.SAMDriver.SAMDriver.__init__ | ( | self | ) |
Initialisation for SAMDriver.
Definition at line 40 of file SAMDriver.py.
def SAM.SAM_Core.SAMDriver.SAMDriver.formatGeneratedData | ( | self, | |
instance | |||
) |
Method which receives an instance generated from a model via a label and formats the received vector by reshaping it or adding crucial data with it for it to be deciphered at the receiving end.
instance | A vector of generated data. |
Definition at line 373 of file SAMDriver.py.
def SAM.SAM_Core.SAMDriver.SAMDriver.loadParameters | ( | self, | |
parser, | |||
trainName | |||
) |
Function to load parameters from the model config.ini file.
Method to load parameters from file loaded in parser from within section trainName and store these parameters in self.paramsDict,
parser | SafeConfigParser with pre-read config file. |
trainName | Section from which parameters are to be read. |
Definition at line 105 of file SAMDriver.py.
def SAM.SAM_Core.SAMDriver.SAMDriver.prepareData | ( | self, | |
model = 'mrd' , |
|||
Ntr = 50 , |
|||
randSeed = 0 , |
|||
normalise = True |
|||
) |
Method for randomly splitting data and preparing Y dictionary.
This method splits the data in the model randomly between training and testing. Currently does not take equal number of samples from different classes.
model | String with type of model to be trained. Accepted values are 'mrd' and 'bgplvm' . |
Ntr | Float percentage for the training/testing division of data. |
randSeed | Integer random seed. |
normalise | Boolean turning normalisation of data on or off. |
Definition at line 271 of file SAMDriver.py.
def SAM.SAM_Core.SAMDriver.SAMDriver.processLiveData | ( | self, | |
dataList, | |||
thisModel, | |||
verbose = False |
|||
) |
Method which receives a list of data frames and outputs a classification if available or 'no_classification' if it is not.
dataList | List of dataFrames collected. Length of list is variable. |
thisModel | List of models required for testing. |
verbose | Boolean turning logging to stdout on or off. |
Definition at line 361 of file SAMDriver.py.
def SAM.SAM_Core.SAMDriver.SAMDriver.readData | ( | self, | |
root_data_dir, | |||
participant_index, | |||
args, | |||
kw | |||
) |
Method which accepts a data directory, reads all the data in and outputs self.Y which is a numpy array with n instances of m length feature vectors and self.L which is a list of text Labels of length n.
root_data_dir | Data directory. |
participant_index | List of subfolders to consider. Can be left as an empty list. |
Definition at line 347 of file SAMDriver.py.
def SAM.SAM_Core.SAMDriver.SAMDriver.saveParameters | ( | self | ) |
Method to store variables generated during training which are required during interaction in self.paramsDict.
None |
Definition at line 117 of file SAMDriver.py.
def SAM.SAM_Core.SAMDriver.SAMDriver.testPerformance | ( | self, | |
testModel, | |||
Yall, | |||
Lall, | |||
YtestAll, | |||
LtestAll, | |||
verbose | |||
) |
Method for testing the whole dataset for overall performance.
Returns a confusion matrix.
This implementation is a standard performance testing method that can be overridden by an inheriting child.
testModel | SAMObject Model to be tested. |
Yall | Numpy array with training data vectors to be tested. |
Lall | List with corresponding training data labels. |
YtestAll | Numpy array with testing data vectors to be tested. |
LtestAll | List with corresponding testing data labels. |
verbose | Boolean turning logging to stdout on or off. |
Definition at line 142 of file SAMDriver.py.
def SAM.SAM_Core.SAMDriver.SAMDriver.training | ( | self, | |
modelNumInducing, | |||
modelNumIterations, | |||
modelInitIterations, | |||
fname, | |||
save_model, | |||
economy_save, | |||
keepIfPresent = True , |
|||
kernelStr = None |
|||
) |
Method to train, store and load the learned model.
This method tries reloading the model in fname. If unsuccessful or loaded model has mismatching parameters, trains a new model from scratch.
modelNumInducing | Integer number of inducing parameters. |
modelNumIterations | Integer number of training iterations. |
modelInitIterations | Integer number of initialisation iterations. |
fname | Filename to save model to. |
save_model | Boolean to turn saving of the model on or off. |
economy_save | Boolean to turn economy saving on or off. Economy save saves smaller models by not storing data inside the model but keeping it stored in the data path. |
keepIfPresent | Boolean to enable or disable loading of a model when one is available. |
kernelStr | Kernel string with the requested kernel. If None the default kernel is used. |
Definition at line 172 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.additionalParametersList |
Definition at line 90 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.calibrated |
Definition at line 74 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.classif_thresh |
Definition at line 84 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.classifiers |
Definition at line 83 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.data_labels |
Definition at line 59 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.fname |
Definition at line 70 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.L |
Definition at line 45 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.Lall |
Definition at line 79 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.listOfModels |
Definition at line 64 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.Ln |
Definition at line 54 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.Ltest |
Definition at line 48 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.LtestAll |
Definition at line 81 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.Ltestn |
Definition at line 50 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.model_init_iterations |
Definition at line 88 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.model_mode |
Definition at line 62 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.model_num_inducing |
Definition at line 86 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.model_num_iterations |
Definition at line 87 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.model_type |
Definition at line 65 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.modelLabel |
Definition at line 66 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.modelLoaded |
Definition at line 72 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.optimiseRecall |
Definition at line 71 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.parallelOperation |
Definition at line 73 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.paramsDict |
Definition at line 60 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.participantList |
Definition at line 68 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.Quser |
Definition at line 63 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.rawData |
Definition at line 76 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.rawTextData |
Definition at line 75 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.SAMObject |
Definition at line 42 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.segTestConf |
Definition at line 57 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.segTestPerc |
Definition at line 58 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.segTrainConf |
Definition at line 55 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.segTrainPerc |
Definition at line 56 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.textLabels |
Definition at line 67 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.varianceThreshold |
Definition at line 69 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.verbose |
Definition at line 61 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.X |
Definition at line 46 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.Y |
Definition at line 44 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.Yall |
Definition at line 78 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.Ymean |
Definition at line 51 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.Yn |
Definition at line 53 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.Ystd |
Definition at line 52 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.Ytest |
Definition at line 47 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.YtestAll |
Definition at line 80 of file SAMDriver.py.
SAM.SAM_Core.SAMDriver.SAMDriver.Ytestn |
Definition at line 49 of file SAMDriver.py.