FaceChannel.SelfAffectiveMemory Model Definition
FaceChannel.SelfAffectiveMemory.SelfAffectiveMemory module
SelfAffectiveMemory.py
Self-Affective memory model.
- class FaceChannel.SelfAffectiveMemory.SelfAffectiveMemory.SelfAffectiveMemory(numberOfEpochs=5, insertionThreshold=0.9, learningRateBMU=0.35, learningRateNeighbors=0.76)
Bases:
object
- buildAffectiveMemory(dataTrain)
Method that activey builds the current affective memory
- Parameters
dataTrain – initial training data as an ndarray.
- getNodes()
Method that returns all the current nodes of the affective memory :return: a tuple of nodes and ages of each node. :rtype: ndarray tuple
- insertionThreshold = 0.9
Activation threshold for node insertion
- learningRateBMU = 0.35
Learning rate of the best-matching unit (BMU)
- learningRateNeighbors = 0.76
Learning rate of the BMU’s topological neighbors
- numberOfEpochs = 5
Number of traning epoches for the GWR
- predict(images, preprocess=False)
- Method that predicts the current arousal and valence of a given image or set of images.
as the affective memory is an online learning method, every given frame must be temporaly subsequent to the previous ones. It relies on the FaceChannelV1 for feature extraction.
- Parameters
images – The images as one or a list of ndarray.
preprocess – If the image is already pre-processed or not. a pre-processed image has a format of (64,64,1).
- Returns
The prediction of the given image(s) as a ndarray
- Return type
ndarray
- train(dataPointsTrain)
Method that trains the affective memory online :param dataTrain: initial training data as an ndarray.