End-to-end machine learning pipeline to predict customer churn.
Live Demo: http://54.89.48.203:8501
- Organized the code in different directories
root_directory/ │ ├──app.py ├── utils.py ├── data/ ├── models/ ├── notebooks/ ├── prompts/ ├── README.md └── requirements.txt - Pre-processing
- Fitted
StandardScaleronly with the train data - Saved fitted scaler to use during inference
- Fitted
- Training
- Added a
CatBoostClassifiermodel - Set hyperparmeters for tree-based models
- Added a
- Inference
- Added pre-processing to properly handle inference data
- Prompt Engineering:
- Simplified and reorganized prompts
- Provided feature importance values as JSON
- Deployment
- Deployed Streamlit web app with AWS
-
Create an EC2 instance in AWS:
- OS: Ubuntu
- Instance Type: t2.micro
- Create a new Key pair to access the instance via SSH
-
Download the
.pemfile amd set permissions:chmod 400 <your-key-file.pem>
-
Connect via SSH
ssh -i </path/to/your-key-file.pem ubuntu@your-instance-public-ip>
-
Clone repo
git clone https://github.com/matteopilotto/customer-churn-prediction.git -
Create a
.envfile in the root directory of the repo and add the Groq api key:GROQ_API_KEY=<your_groq_api_key> -
Update sytem, set up Python environment, and install required libraries:
chmod +x setup.sh source setup.sh -
Create a new tmux session:
tmux new -s streamlit_session -
Launch streamlit app:
streamlit run app.py --server.address 0.0.0.0 --server.port 8501 -
To detach from the tmux session press
CTRL+B + D -
Access the Stramlit app via the EC2 public IP address:
http://<your-ec2-public-ip>:8501
-
To reattach to a tmux session, use the following command:
tmux attach -t <your-tmux-session-name> -
To list the active tmux sessions, use the following command:
tmux ls -
To terminate a tmux session, use the following command:
tmux attach -t <your-tmux-session-name>
- Headstarter.co
- Matteo Pilotto
