Check out the Complete report here
- Calculate statistics for numerical features.
- Check the distribution of continuous variables.
- Explored the unique values in each categorical feature.
- Analyzed the cardinality of categorical variables.
- Verify if there are any missing values in the dataset.
- Ensure data completeness.
- Analyze age vs. churn rate.
- Explore the distribution of subscription length.
- Investigate the distribution of monthly bills.
- Examine the distribution of total data usage.
- Visualize churn rate by location.
- Perform
one-hot encoding
for Gender. - Created the
Billing_Per_Usage
feature, which is the ratio of Monthly_Bill toTotal_Usage_GB
. - Generated the
Tenure
feature, representing the remaining subscription length. - Encoded the
Location
feature usingTargetEncoder
. - Scale numerical features using
StandardScaler
. - Split the data into
training
andtesting
sets.
- Choose the Logistic Regression model for binary classification.
- Utilized Randomized Search CV for hyperparameter optimization.
- Defined hyperparameter ranges for logistic regression.
- Penalty: ['l1', 'l2', 'elasticnet', 'none']
- C: Uniform distribution between 0 and 4
- Solver: ['newton-cg', 'lbfgs', 'liblinear', 'sag', 'saga']
- Maximum Iterations: [100, 200, 300, 400, 500]
- Create a Flask API for model deployment.
- Expose a
/predict
endpoint that accepts JSON requests with customer features. - Return JSON responses with predicted churn status.
app.py
: Flask application.churn.ipynb
: Jupyter notebook for the project.config/
: Directory containing model, encoder, and scaler files.data/
: Directory with the dataset file.test.py
: Python script for testing the deployed model.transform.py
: Feature engineering script.
To run the project:
- Start the Flask server with
python app.py
. - Use
test.py
to send POST requests to the/predict
endpoint to make predictions.
Example Input JSON:
{
"Age": [32],
"Gender": ["Male"],
"Location": ["Houston"],
"Subscription_Length_Months": [12],
"Monthly_Bill": [48.76],
"Total_Usage_GB": [172]
}
Example Output JSON :
{'predictions': [1]}