Patient Satisfaction Prediction is a machine learning project that predicts patient satisfaction levels using doctor related metrics. Designed with efficiency, clarity, and model benchmarking in mind, complete with automated evaluation.
This project explores how doctor experience, fees, wait times, and other metrics impact patient satisfaction. It applies various machine learning techniques to:
- π Preprocess and normalize raw data
- π€ Train and evaluate multiple models (manually + via LazyPredict)
- π Benchmark performances
- π Save results for further analysis
- β Handles missing values automatically
- π Normalizes numerical data using
MinMaxScaler
- βοΈ Balances dataset using SMOTE
- π§ͺ Trains multiple classifiers including:
- Logistic Regression
- Random Forest
- Decision Tree
- AdaBoost
- KNN
- SVM
- Naive Bayes
- XGBoost
- π€ Uses
LazyPredict
to automatically benchmark many models - π Saves model performance comparisons as CSV
- π― Voting Classifier for accuracy boosting
- π¦ Cleanly modular and well-commented code
- Location:
./dataset/doctors_dataset.csv
- Contains:
- Experience (Years)
- Total Reviews
- Satisfaction Rate (%)
- Avg Time to Patients
- Wait Time
- Fee (PKR)
- Target label (Satisfaction: Satisfied / Unsatisfied)
Type | Tools/Libraries |
---|---|
Programming | Python 3.11+ |
ML Frameworks | scikit-learn , xgboost , lazypredict , imblearn |
Visualization | seaborn , matplotlib |
Data | pandas , numpy |
IDE | Jupyter Notebook / VS Code |
# Clone the repo
git clone https://github.com/Usama-Codez/Patient-Satisfaction-Prediction.git
cd Patient-Satisfaction-Prediction
Create & activate a virtual environment
python -m venv newenv
newenv\Scripts\activate
Install dependencies
pip install -r requirements.txt
You can Use any of the following IDEs:
- Jupyter Notebook
- Jupyter Lab
- Google Colab Make sure to select the correct environment when running your notebook.
π π Confusion Matrix, ROC curve and Evaluations:
Accuracy: 58.76% Precision: 0.95 Recall: 0.59 F1 Score: 0.73 ROC-AUC: 0.5667822806377023
Accuracy: 90.58% Precision: 0.95 Recall: 0.95 F1 Score: 0.95 ROC-AUC: 0.735426554703663
Accuracy: 90.96% Precision: 0.94 Recall: 0.96 F1 Score: 0.95 ROC-AUC: 0.7725142996227334
Accuracy: 72.32% Precision: 0.95 Recall: 0.75 F1 Score: 0.84 ROC-AUC: 0.6031702567847147
Accuracy: 76.27% Precision: 0.94 Recall: 0.80 F1 Score: 0.86 ROC-AUC: 0.5284166970913959
Accuracy: 79.66% Precision: 0.95 Recall: 0.83 F1 Score: 0.88 ROC-AUC: 0.6035049288061336
Accuracy: 63.09% Precision: 0.95 Recall: 0.64 F1 Score: 0.76 ROC-AUC: 0.5259827187538031
Accuracy: 77.21% Precision: 0.96 Recall: 0.79 F1 Score: 0.87 ROC-AUC: 0.7437325057806986
Fitting 3 folds for each of 108 candidates, totalling 324 fits Best Parameters: {'max_depth': None, 'min_samples_leaf': 1, 'min_samples_split': 2, 'n_estimators': 100} Best Cross-Validation Accuracy: 0.9363507779349364
This project is licensed under the MIT License.