-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added the main.py and readme along with dataset file #207
Open
Dharun235
wants to merge
2
commits into
yashasvini121:master
Choose a base branch
from
Dharun235:project1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Customer Churn Prediction with Random Forest | ||
|
||
## 📝 Project Overview | ||
This project aims to predict customer churn in a subscription-based service using a Random Forest Classifier. Customer churn prediction is critical for businesses like telecom, where retaining customers is essential to sustain revenue. By identifying customers likely to churn, companies can take proactive retention measures. | ||
|
||
## 📊 Dataset | ||
The project uses the **Telco Customer Churn Dataset**, which contains information on customer demographics, service usage, and account details. | ||
|
||
### Dataset Columns | ||
- **Demographics**: Gender, senior citizen status, partner status, etc. | ||
- **Account Details**: Contract type, payment method, tenure, etc. | ||
- **Service Usage**: Internet service, additional services like streaming, etc. | ||
- **Target Variable**: `Churn` (Yes or No) | ||
|
||
## 🧠 Model Description | ||
The Random Forest Classifier is chosen for its ability to handle a mixture of feature types and evaluate feature importance. This interpretable, efficient model is suited for binary classification tasks like churn prediction. | ||
|
||
## 🔍 Project Steps | ||
1. **Data Loading and Preprocessing**: | ||
- Remove irrelevant columns (e.g., `customerID`). | ||
- Encode categorical features and target variable. | ||
- Scale numerical features. | ||
|
||
2. **Train-Test Split**: | ||
- Split the dataset into training and testing sets. | ||
|
||
3. **Model Training**: | ||
- Use the Random Forest Classifier with 100 trees and fit it to the training data. | ||
|
||
4. **Evaluation**: | ||
- Measure accuracy, precision, recall, and F1 score to assess model performance. | ||
- Generate a classification report and display feature importance. | ||
|
||
5. **Feature Importance Analysis**: | ||
- Identify key factors influencing customer churn, which can aid in designing retention strategies. | ||
|
||
## 📈 Results | ||
- The model aims for an accuracy of 80-85%, with precision, recall, and F1-score providing further insights into its performance. | ||
- Feature importance analysis helps identify significant attributes, like `Contract Type`, `Tenure`, and `Monthly Charges`, which are closely linked to churn. | ||
|
||
## 🚀 Running the Project | ||
1. **Clone the repository** and navigate to the project directory. | ||
2. **Install dependencies**: | ||
```bash | ||
pip install pandas scikit-learn | ||
3. Run the script: | ||
```bash | ||
python churn_prediction.py | ||
|
||
## 📄 Future Improvements | ||
- Experiment with other models (e.g., Gradient Boosting, XGBoost) for potential accuracy gains. | ||
- Tune hyperparameters to enhance model performance. | ||
- Apply cross-validation for a more robust evaluation. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this file. Add the relevant model details to
App.py