How tulika105/diabetes_prediction works
Main Components
• Data Source: Represent the CSV file (diabetes_prediction_dataset.csv) as the raw data input.
• Data Preprocessing: Show a component that cleans and preprocesses the data. This stage includes handling missing values, encoding categorical features, scaling numerical ones (via StandardScaler), and applying hybrid sampling (SMOTE and under-sampling) to balance the data.
• Modeling: Illustrate the training phase where multiple machine-learning models are considered (e.g., Logistic Regression, SVM, Decision Tree, and the XGBoost classifier). Emphasize that the XGBoost model provided the best performance.
• Model Persistence: Represent the saved model (XGB.pkl) which is the output of the model training/evaluation pipeline.
• Prediction Module: Include the diabetes_predict.py component that likely serves as the interface or function for making predictions using the persisted model.
• Interactive Deployment: Highlight the deployment via Streamlit (as referenced by the provided deployment URL). This component will be the user-facing interface that accepts patient inputs to predict diabetes status.
• Notebook Exploration: Optionally note the Jupyter Notebook (Diabetes Prediction (1).ipynb) as part of exploratory data analysis, model experimentation, and evaluation steps.
Detailed Relationships and Interactions
• Data flows from the raw dataset (CSV) into the preprocessing phase.
• Preprocessed data is fed into the modeling/training component where several algorithms are experimented with.
• Model evaluation is performed using standard metrics (accuracy, precision, recall, F1-score) with results documented in the notebook.
• The best model (XGBoost) is serialized (using Pickle to create XGB.pkl) for later use.
• The diabetes_predict.py script utilizes the saved model to perform inference.
• Finally, the Streamlit deployment layer brings the trained model to production, allowing end users to input data and receive predictions.
Architectural Patterns and Design Principles
• Separation of Concerns: Data ingestion, preprocessing, modeling, and deployment are cleanly separated, which can be depicted as distinct components.
• Reusability: Model persistence allows the trained model to be reused across multiple sessions or deployments.
• Modularity: Even though the system is small, modularity is maintained between the training (in the notebook) and the production inference (diabetes_predict.py and the Streamlit app).