How to deploy a Node.js app integrated with a ML algorithm on AWS EBS + CodePipeline
Greetings everyone! It was very compelling when Machine Learning India said, "Stop training and start deploying". So here I am describing my work #1.
APRIORI ALGORITHM AND COMBINATION WITH NODE.JS
In my own words, I can describe the algorithm as: A mini recommendation system which works like, "Customers who bought this also bought that".
- Set a minimum support and confidence
- Take all the subsets in transactions having higher support than minimum support
- Take all the rules of these subsets having higher confidence than the minimum confidence
- Sort the values by decreasing lift
Support(I) = (#Transactions containing I)/#Transactions
Confidence(I1 --> I2) = (#Transactions containing I1 and I2)/#Transactions containing I1
Lift = Confidence(I1 --> I2)/Support(I2)
The dataset that I have used consists of records of items that are bought per customer. Using this, I have drafted the final dataframe containing the items that can be potentially bought together based on customer choices. I saved this dataframe to a new csv file and read it in Node.js because using python directly for processing requests gave me timeout errors when I deployed the final app on EBS.
Note: This was done only for practice purpose and its not a full fledged app. My main intention here was to DEPLOY.
DEPLOYMENT
Elastic Beanstalk is a PaaS of AWS Computing services.
- Easy to use service for deploying and scaling web apps and services developed with Java, .NET, PHP, Node.js, Python, Ruby etc..
- Handles deployment from capacity provisioning, load balancing to auto scaling
EBS + CODEPIPELINE
- Sign in to your AWS console
- Choose 'Elastic Beanstalk' under compute services
- After filling the above page, click on 'Services' at the top left corner and choose 'CodePipeline' under Developer Tools. Create a new pipeline
- Choose storage option of your choice(Github in my case)
- Create a github repository, add, commit and push all your files into that repository and connect your pipeline to your github repository
- Click on 'Skip Build Stage' at the bottom right
- Choose AWS Elastic Beanstalk in deploy stage
- Add your application and environment name
- Wait for the process to finish and access Elastic Beanstalk > Environments > 'your environment' and press the link provided at the top
- Your node app has been successfully deployed
I am publishing two articles today. Please check out the other one if you haven't at : https://www.garudax.id/pulse/how-deploy-flask-app-integrated-ml-algorithm-gcp-engine-ambati/?published=t
GitHub Link : https://github.com/shiv2110/ml-node-aws