Algorithms for EC2 & Web
Cloud server read data from dynamoDB and will further process the data, especially for the machine learning part. Here, we use a SVM model for machine learning, the input is the four customer behavior data mentioned before, the output is the label that whether customer like the food. We use a Training set of 2000 data records (200 real data and 1800 synthesized data), and we reach a cross validation accuracy of [0.7826087, 0.85714286 0.8625, 0.86163522, 0.8427673]. After the machine learning, we upload the final data stream to dynamoDB, and decide whether to send alert (when remaining food is low or time since last refill is too long).
the flow chart of this process:
the flow chart of this process:
The web page is hosted on amazon S3 bucket under static hosting method. the javascript will use chart.js API and also will extract data from amazon dynamoDB, then use the extracted data to create chart of food consumption speed and food remain stock. There is also a js loop interval function to dynamically update the result to achieve real time data displaying. Corrupted data will be dropped.
Besides, the customers can use refill button to update the refill time so they can record the newest refill time.
Besides, the customers can use refill button to update the refill time so they can record the newest refill time.
To Sum Up
- From Raspberry PI to Cloud
- Raspberry Pi uploads the data to DynamoDB.
- Raspberry Pi uploads the data to DynamoDB.
- From server to data output:
- The server access DB in a regular time and clean the data in DB.
- The server calculates how fast the food is consumed and estimates the run out of time. Meanwhile, the server provides whether the food is out of time (not fresh anymore) based on a pre-set timeline.
- After receiving enough data, the server will send data to a ML model, the model use data such as how long the customer will stay in front of the food, how long they will take the food and the amount of food they take within a period of time to estimate the customers’ food preference and hesitation.
- All the processed data will be present in a website in a user-friendly way.
- A food refill alert will be sent to user’s email if food remaining is low.
- The server access DB in a regular time and clean the data in DB.