Closed El-Dringo-Brannde closed 6 years ago
Alexa supports setting and passing along session attributes in the form of key:value pairs. The sessionAttributes variable is setup in the LambaIntent.js file and used in the routes.js example.
function buildResponse(sessionAttributes, speechletResponse) {
return {
version: '1.0',
sessionAttributes,
response: speechletResponse,
};
}
callback(sessionAttributes, buildResponse(cardTitle, speechOutput, repromptText, false));
The sessionAttributes are retained and passed along through the session. The session continues until the buildResponse receives a true value for shouldEndSession. The functions that will take the requests can check these values and if they are current they can be used to fill in any blanks in a future request.
"sessionAttributes": {'model': (self.model.serialize() if self.model else {})},
...
session_attributes = resp['sessionAttributes'] if resp and 'sessionAttributes' in resp else {}
Found here here
For machine learning for the stretch goal of heart rate monitoring to identify important trends: A paper was published in 2005 on identifying emotional response with machine learning using heart rate variability and skin resistance. They achieved an accuracy of 80.2% using a Multilayer Perceptron (MLP) structure. source MXNet is a machine learning framework by the Apache Software Foundation. It is lightweight enough to even run on phones and supports running work on multiple processors without much setup. It supports running MLP structures and does so at a rate on par with or faster than the other major frameworks, such as TensorFlow. source
A basic sample of implementing MLP within MXNet can be found here
import mxnet as mx
def get_symbol(num_classes=10, **kwargs):
data = mx.symbol.Variable('data')
data = mx.sym.Flatten(data=data)
fc1 = mx.symbol.FullyConnected(data = data, name='fc1', num_hidden=128)
act1 = mx.symbol.Activation(data = fc1, name='relu1', act_type="relu")
fc2 = mx.symbol.FullyConnected(data = act1, name = 'fc2', num_hidden = 64)
act2 = mx.symbol.Activation(data = fc2, name='relu2', act_type="relu")
fc3 = mx.symbol.FullyConnected(data = act2, name='fc3', num_hidden=num_classes)
mlp = mx.symbol.SoftmaxOutput(data = fc3, name = 'softmax')
return mlp
Instead of merely asking Alexa question for every command. Alexa should start to understand phrases and trends, as such Machine Learning and AI will have to come into play.
Start researching any popular packages that can be used and post them in the comments below