Using Amazon Machine Learning to Predict the Best Time of Day for Exercise – Pt 3: Automating the Model with Alexa – Darian Johnson’s Favorite Things
- After I was able to build a working model, I needed to come up a way to automate the model.
- The user, after successfully linking his/her Fitbit account, will need a custom machine learning model in order for the application to make recommendations.
- Step 3 – Finalizing the Machine Learning Model build
- Integration with Alexa allows a user to obtain a workout recommendation (and create a machine learning model) all by voice command.
- Step 4 – Using the Model to make a recommendation
Integration with Alexa allows a user to obtain a workout recommendation (and create a machine learning model) all by voice command.
@gp_pulipaka: Amazon #MachineLearning predicts the Best Time for Exercise. #BigData #DataScience #AI
After I was able to build a working model, I needed to come up a way to automate the model. I originally planned to allow access through my website, but decided to use Alexa in addition to the website link.
Note: The process of creating an Alexa skill isn’t too complicated (if you have experience building lambda functions). That being said, I suggest you start by building a sample skill – such as the Fact Skill example. Also, be sure to read and follow the certification requirements.
Alexa, AWS, and the exposed Fitbit APIs provided a mechanism to build a model and return results for a specific user – all initiated by voice.
Step 1 – Linking the user’s Fitbit account to the skill
A user has to link his/her Fitbit account to the skill before s/he can (a) build a specific machine learning model based on their history and (b) get a workout recommendation. Step 1 covers the logic for this functionality.
Click image to enlarge
Step 2 – Building a Machine Learning model for the user
The user, after successfully linking his/her Fitbit account, will need a custom machine learning model in order for the application to make recommendations. The machine learning data source (build from the user’s Fitbit activity history) and the prediction engine are automatically build using additional AWS Lambda functions.
Click image to enlarge
The creation of the data source and the creation and evaluation of the learning model can take between 20-40 minutes, so I created a second Lambda function to poll the status of the machine learning widgets in order to take actions needed to complete the models.
After the model is created, a user is then able to ask Alexa to make a workout recommendation. Alexa, using day-of data from the Fitbit platform, feeds the recommendation engine and returns a time of day for the optimal workout.