How ashumishrag/arogoai_mentalhealthmodel works
Main Components
• Data Layer:
• A CSV file (data/mental_health_data.csv) that holds the dataset.
• Preprocessing logic in src/data_preprocessing.py.
• Model Training & Evaluation:
• Script for training (src/train_model.py) that cleans, engineers features, trains multiple models, evaluates them (using metrics like Accuracy, F1-score, ROC-AUC), and saves the best performing model as models/best_model.pkl.
• Integration of SHAP for model interpretability.
• Inference Modules:
• Command-Line Interface: src/predict_mental_health.py that handles user symptom input, prediction, and outputs a SHAP explanation as an HTML file.
• Web UI: mental_health_ui.py built with Streamlit, which offers interactive input, displays prediction probabilities, and embeds the SHAP explanation directly.
• Configuration & Dependencies:
• requirements.txt for the Python dependencies.
• README.md for overall context and reference.
Relationships and Interactions
• The data layer feeds into the data preprocessing module.
• Preprocessed data is used by the model training script to train and evaluate various models.
• The best model is serialized (as a .pkl file) and used by the inference modules.
• Both the CLI inference and the Streamlit UI load the model to predict outcomes based on new user inputs.
• SHAP is integrated post-prediction to generate explanations for the model decisions.
Architectural Patterns and Design Principles
• Clear separation of concerns: Data ingestion/preprocessing, model training, and inference/UI are modularized in different scripts.
• Reusability: The best model file (models/best_model.pkl) is shared across different inference implementations.
• Extensibility: Adding additional inference routes (e.g., RESTful APIs) or improving UI components can be done without disrupting the training pipeline.
Technologies and Frameworks
• Python is the primary language with packages such as scikit-learn.
• SHAP for model interpretability.
• Streamlit for the web UI.
• Pandas and possibly NumPy for data manipulation.