Skip to content

Commit

Permalink
Changes made acc to the tutorial.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Dharun235 committed Nov 8, 2024
1 parent 6586eca commit 93933ab
Show file tree
Hide file tree
Showing 20 changed files with 7,746 additions and 463 deletions.
129 changes: 22 additions & 107 deletions App.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
""")

st.markdown("""
## Why Choose Predictive Calc? """)
## Why Choose Predictive Calc?
""")

features = [
{
"title": "Accurate Predictions",
Expand Down Expand Up @@ -66,7 +68,7 @@
st.markdown("---")
st.markdown("## Available Calculators")

# Calculator information in a structured format
# Calculator information in a structured format, including the new Churn Prediction Calculator
calculators = [
{
"name": "Income Estimator",
Expand All @@ -93,117 +95,30 @@
- **GLD**: The price of SPDR Gold Shares (GLD), which is the target variable representing gold prices.
"""
},
{
"name": "House Price Estimator",
"description": "Predict the price of a house based on various features.",
"details": """
Using historical and current market data, this tool predicts the house price based on features like location, size, and amenities.
"""
},
{
"name": "Loan Eligibility",
"description": "Check your eligibility for various types of loans based on your financial profile.",
"details": """
This calculator assesses loan eligibility by analyzing credit scores, income, and other relevant financial details.
"""
},
{
"name": "Parkinson's Disease",
"description": "Assess your risk of Parkinson's Disease with advanced ML algorithms.",
"details": """
### Introduction
Parkinson's disease (PD) is a progressive neurodegenerative disorder that primarily affects movement. It often starts with subtle symptoms such as tremors, stiffness, and slow movement.
### Oxford Parkinson's Disease Detection Dataset (UCI ML Repository)
The dataset contains biomedical voice measurements from 31 people, 23 of whom have Parkinson's disease (PD). The main goal is to differentiate between healthy individuals and those with PD using the "status" column, where 0 indicates healthy and 1 indicates PD.
### Additional Variable Information
- **MDVP_Fo(Hz)**: Average vocal fundamental frequency.
- **MDVP_Fhi(Hz)**: Maximum vocal fundamental frequency.
- **MDVP_Flo(Hz)**: Minimum vocal fundamental frequency.
- **MDVP_Jitter(%)**, **MDVP_Jitter(Abs)**, **MDVP_RAP**, **MDVP_PPQ**, **Jitter_DDP**: Measures of variation in fundamental frequency.
- **MDVP_Shimmer**, **MDVP_Shimmer(dB)**, **Shimmer_APQ3**, **Shimmer_APQ5**, **MDVP_APQ**, **Shimmer_DDA**: Measures of variation in amplitude.
- **NHR**, **HNR**: Noise-to-tonal ratio measures in the voice.
- **status**: Health status of the subject (1 - Parkinson's, 0 - healthy).
- **RPDE**, **D2**: Nonlinear dynamical complexity measures.
- **DFA**: Signal fractal scaling exponent.
- **spread1**, **spread2**, **PPE**: Nonlinear measures of fundamental frequency variation.
"""
},
{
"name": "Sleep Disorder Prediction",
"description": "Assess your risk of developing a sleep disorder using advanced ML algorithms.",
"details": """
### Introduction
Sleep disorders can have a significant impact on an individual's overall health and well-being. These disorders often result from a combination of poor sleep habits, lifestyle factors, stress, and underlying medical conditions.
### Sleep Health and Lifestyle Dataset
The dataset consists of sleep, lifestyle, and health metrics collected from 400 individuals. The main goal is to predict the likelihood of an individual having a sleep disorder using the "Sleep Disorder" column, which contains categorical values indicating the presence or absence of a sleep disorder.
# Existing calculators...

"""
},
# New entry for the Churn Prediction Calculator
{
"name": "PDF Malware Detector",
"description": "Identify and alert users about potential malware in PDF files.",
"name": "Churn Prediction",
"description": "Assess the likelihood of customer churn based on their profile and service usage patterns.",
"details": """
### Overview
The PDF Malware Detector scans uploaded PDF files for malicious content, ensuring user safety and data protection.
### Key Features
- **File Upload**: Simple drag-and-drop interface for easy file submission.
- **Malware Detection**: Comprehensive analysis to detect harmful elements within PDFs.
- **File Size Limit**: Supports files up to 200MB.
### Use Cases
Perfect for users needing to verify the integrity of PDF documents before opening or sharing.
"""
},
{
"name": "Stress Level Detector",
"description": "Analyze your mental stress levels based on social media interactions.",
"details": """
The model uses text analysis on social media data to identify signs of stress, helping users understand their mental health patterns.
"""
},
{
"name": "Text Summarizer",
"description": "Save time with concise, professional summaries of lengthy texts.",
"details": """
Generate quick and comprehensive summaries of lengthy documents, ideal for students, researchers, and professionals.
"""
},
{
"name": "Real-Time Language Translator",
"description": "Translate spoken language into other languages instantly for seamless communication.",
"details": """
### Overview
The Real-Time Language Translator uses advanced speech recognition and NLP to provide immediate translations between languages, enhancing communication in diverse settings.
### Key Features
- **Instant Translation**: Real-time spoken language translation.
- **Multiple Languages**: Supports a variety of source and target languages.
- **User-Friendly Interface**: Easy to navigate for all users.
### Use Cases
Ideal for travel, business meetings, and language learning, breaking down language barriers effortlessly.
### Introduction
Customer churn prediction is essential for subscription-based businesses, as it enables proactive measures to retain customers. This calculator uses demographic, account, and service data to assess a customer's likelihood of discontinuing service.
### Dataset Information
The dataset includes various factors such as:
- **Demographics**: Age, gender, partner status, and dependents.
- **Account Details**: Tenure, contract type, paperless billing, and payment method.
- **Service Usage**: Phone and internet service usage, streaming services, and tech support.
### Key Features
- **Proactive Retention**: Identify high-risk customers for targeted retention strategies.
- **Insightful Analytics**: Understand patterns and factors contributing to customer churn.
- **Adaptability**: Designed for telecom and other subscription-based businesses.
"""
},
{
"name": "Business Performance Forecaster",
"description": "Forecast business profits based on various investment areas for better financial planning and budget allocation.",
"details": """
### Overview
The Business Performance Forecaster predicts company profit based on investment in R&D, administration, and marketing, using machine learning to analyze investment patterns and optimize budget allocation.
### Key Features
- **Profit Prediction**: Provides an estimated profit based on investment data.
- **Investment Analysis**: Evaluates how different spending areas impact overall profit.
- **Multi-Input Support**: Accounts for multiple variables like R&D, administration, and marketing expenses.

### Use Cases
Useful for companies looking to plan budgets, assess the impact of investments, and improve decision-making processes in financial forecasting.
"""
}
# Other calculators...
]

# Define shades of blue for calculators
Expand Down
44 changes: 44 additions & 0 deletions form_configs/churn_prediction.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"form_fields": [
{"name": "gender", "label": "Gender", "type": "dropdown", "options": ["Male", "Female"], "default": "Female"},
{"name": "SeniorCitizen", "label": "Senior Citizen", "type": "number", "default": 0},
{"name": "Partner", "label": "Partner", "type": "dropdown", "options": ["Yes", "No"], "default": "No"},
{"name": "Dependents", "label": "Dependents", "type": "dropdown", "options": ["Yes", "No"], "default": "No"},
{"name": "tenure", "label": "Tenure (Months)", "type": "number", "default": 1},
{"name": "PhoneService", "label": "Phone Service", "type": "dropdown", "options": ["Yes", "No"], "default": "Yes"},
{"name": "MultipleLines", "label": "Multiple Lines", "type": "dropdown", "options": ["Yes", "No", "No phone service"], "default": "No"},
{"name": "InternetService", "label": "Internet Service", "type": "dropdown", "options": ["DSL", "Fiber optic", "No"], "default": "No"},
{"name": "OnlineSecurity", "label": "Online Security", "type": "dropdown", "options": ["Yes", "No", "No internet service"], "default": "No"},
{"name": "OnlineBackup", "label": "Online Backup", "type": "dropdown", "options": ["Yes", "No", "No internet service"], "default": "No"},
{"name": "DeviceProtection", "label": "Device Protection", "type": "dropdown", "options": ["Yes", "No", "No internet service"], "default": "No"},
{"name": "TechSupport", "label": "Tech Support", "type": "dropdown", "options": ["Yes", "No", "No internet service"], "default": "No"},
{"name": "StreamingTV", "label": "Streaming TV", "type": "dropdown", "options": ["Yes", "No", "No internet service"], "default": "No"},
{"name": "StreamingMovies", "label": "Streaming Movies", "type": "dropdown", "options": ["Yes", "No", "No internet service"], "default": "No"},
{"name": "Contract", "label": "Contract Type", "type": "dropdown", "options": ["Month-to-month", "One year", "Two year"], "default": "Month-to-month"},
{"name": "PaperlessBilling", "label": "Paperless Billing", "type": "dropdown", "options": ["Yes", "No"], "default": "Yes"},
{"name": "PaymentMethod", "label": "Payment Method", "type": "dropdown", "options": ["Electronic check", "Mailed check", "Bank transfer (automatic)", "Credit card (automatic)"], "default": "Electronic check"},
{"name": "MonthlyCharges", "label": "Monthly Charges", "type": "number", "default": 50.0},
{"name": "TotalCharges", "label": "Total Charges", "type": "number", "default": 100.0}
],
"model_input_mapping": {
"gender": "gender",
"SeniorCitizen": "SeniorCitizen",
"Partner": "Partner",
"Dependents": "Dependents",
"tenure": "tenure",
"PhoneService": "PhoneService",
"MultipleLines": "MultipleLines",
"InternetService": "InternetService",
"OnlineSecurity": "OnlineSecurity",
"OnlineBackup": "OnlineBackup",
"DeviceProtection": "DeviceProtection",
"TechSupport": "TechSupport",
"StreamingTV": "StreamingTV",
"StreamingMovies": "StreamingMovies",
"Contract": "Contract",
"PaperlessBilling": "PaperlessBilling",
"PaymentMethod": "PaymentMethod",
"MonthlyCharges": "MonthlyCharges",
"TotalCharges": "TotalCharges"
}
}
53 changes: 0 additions & 53 deletions models/customer-churn-prediction/README.md

This file was deleted.

26 changes: 26 additions & 0 deletions models/customer-churn-prediction/data/dataset_split.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import pandas as pd
from sklearn.model_selection import train_test_split

# Load your dataset
try:
df = pd.read_csv('dataset.csv')
except FileNotFoundError:
print("Error: The file 'dataset.csv' was not found. Please check the file path.")
exit()

# Split the data into features (X) and target (y)
X = df.drop(columns=['Churn']) # Replace 'Churn' with the target column name if different
y = df['Churn']

# Split data into training and test sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Combine X and y back together for each set to save as CSV
train_data = pd.concat([X_train, y_train], axis=1)
test_data = pd.concat([X_test, y_test], axis=1)

# Save the train and test sets as separate CSV files
train_data.to_csv('train_data.csv', index=False)
test_data.to_csv('test_data.csv', index=False)

print("Train and test datasets saved as 'train_data.csv' and 'test_data.csv'")
Loading

0 comments on commit 93933ab

Please sign in to comment.