This project leverages the power of Neural Networks to predict Chronic Kidney Disease (CKD) based on a comprehensive set of health records. Utilizing the UCI Chronic Kidney Disease dataset, this solution provides a robust classification model, complete with detailed data preprocessing, exploratory data analysis, and model interpretability.
π¬ Medical AI at its finest - Helping healthcare professionals make informed decisions through machine learning
- Smart Missing Value Handling: Robust imputation using mean/median for numerical and mode for categorical data
- Data Cleaning: Automated detection and correction of inconsistent data entries
- Feature Engineering: Label encoding, Min-Max scaling, and PCA dimensionality reduction
- Class Balance: RandomOverSampler to handle imbalanced datasets
- Exploratory Data Analysis: Interactive visualizations including pairplots, distribution plots, and boxplots
- Outlier Detection: Advanced statistical methods to identify and handle outliers
- Correlation Analysis: Heatmaps to understand feature relationships
- Sequential Keras Model: Optimized architecture with Dense layers and Dropout
- Hyperparameter Tuning: Fine-tuned for optimal performance
- Early Stopping: Prevents overfitting during training
- Multi-metric Evaluation: Accuracy, F1-Score, AUC, Precision-Recall curves
- Confusion Matrix: Detailed classification performance analysis
- SHAP Integration: Explainable AI for transparent decision-making
- Feature Importance: Understanding which health indicators matter most
Attribute | Description | Type |
---|---|---|
Dataset Source | UCI ML Repository | - |
Instances | 400 patients | - |
Features | 24 health indicators | Mixed |
Target | CKD vs Non-CKD | Binary |
- Age, Blood Pressure, Specific Gravity
- Albumin, Sugar, Red Blood Cells
- Hemoglobin, Packed Cell Volume
- White Blood Cell Count, and more...
Python 3.7+
pip (Python package manager)
# Clone the repository
git clone https://github.com/ryuzaki-ved/ckd_detection
cd chronic-kidney-disease-prediction
# Install required packages
pip install pandas numpy matplotlib seaborn scikit-learn imbalanced-learn tensorflow shap opencv-python
# Run the main prediction script
python code1.py
# For step-by-step analysis
python converted_code.py
π¦ chronic-kidney-disease-prediction/
βββ π README.md # You are here!
βββ π LICENSE # MIT License
βββ π code1.py # Main neural network implementation
βββ π converted_code.py # Step-by-step analysis
βββ π digital_tissue_mapping.py # Additional tissue analysis
βββ π kidney_disease.csv # Original dataset
βββ π Final_pre_processing_data.csv # Processed dataset
βββ π€ kidney_disease_model.h5 # Trained model
βββ π step_by_step.txt # Detailed methodology
βββ π helpful_links.txt # Additional resources
βββ π output_images/ # Generated visualizations
Our Neural Network achieves impressive results:
- π― High Accuracy: Optimized for medical diagnosis standards
- βοΈ Balanced Performance: Handles both CKD and Non-CKD cases effectively
- π Interpretable: SHAP values explain each prediction
- π Comprehensive Metrics: F1-Score, Precision, Recall, AUC
Run the model to see exact performance metrics!
# Generate SHAP explanations
explainer = shap.KernelExplainer(model.predict, x_train)
shap_values = explainer.shap_values(x_test[:100])
shap.summary_plot(shap_values, x_test[:100])
The project generates various visualizations:
- π Training history plots
- π― ROC curves
- π Precision-Recall curves
- π₯ Confusion matrices
- π SHAP feature importance plots
# Load and preprocess data
df = pd.read_csv("kidney_disease.csv")
# ... preprocessing steps ...
# Train model
model = create_neural_network()
history = model.fit(x_train, y_train, epochs=20)
# Make predictions
predictions = model.predict(x_test)
# Explain individual predictions
explain_prediction(model, explainer, sample_index=5)
We welcome contributions! Here's how you can help:
- π΄ Fork the repository
- πΏ Create a feature branch (
git checkout -b feature/AmazingFeature
) - πΎ Commit your changes (
git commit -m 'Add some AmazingFeature'
) - π€ Push to the branch (
git push origin feature/AmazingFeature
) - π Open a Pull Request
- Additional ML algorithms comparison
- Web interface for predictions
- Mobile app integration
- Enhanced visualizations
- Performance optimizations
- π Step-by-Step Guide: See
step_by_step.txt
for detailed methodology - π Helpful Resources: Check
helpful_links.txt
for additional materials - π Research Papers: Explore the
research_papers/
directory
- π UCI Machine Learning Repository for the comprehensive dataset
- π§ TensorFlow Team for the amazing deep learning framework
- π SHAP Contributors for explainable AI capabilities
- π₯ Open Source Community for continuous inspiration
This project is licensed under the MIT License - see the LICENSE file for details.
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π§ Email: [email protected]
If this project helped you, please consider giving it a β!
Made with β€οΈ for better healthcare through AI