Downloads · 30 days
0
lia-prop13/Physical-Mental-Proxy
Physical-Mental-Proxy is a tabular classification model from lia-prop13. Use it for the tabular classification task on the model card, and read the license before you ship it in a product. It is set up for sklearn. The card lists the license as mit.
Downloads · 30 days
0
Access
Public
Updated Sep 1, 2026
Repo size
176 MB
Likes
0
Public
Click a slice to open those files.
.pkl1 GB · 85%
From the Hugging Face model README
- Hugging Face Space - Open in Hugging Face
- Analysis Notebook - View IPYNB File
- Classification Model - Use this model
- Regression Model - Use this model
- Presentation - Watch Project Overview
- Project Roadmap - Jump to Workflow
This project provides an analytical framework to examine how physiological indicators, clinical health data, and daily habits relate to mental health outcomes using the CDC’s Behavioral Risk Factor Surveillance System (BRFSS) dataset. The development process follows a clear progression from exploratory data analysis and feature engineering to the construction of regression and classification models. The result is a comprehensive system that goes beyond simple observations to provide two production-ready models exported for deployment.
How do physiological indicators and lifestyle habits influence an individual's Mental Well-being?
To address this question, the project is structured around three integrated objectives:
This research is driven by an interest in understanding how our broader physical state—including clinical diagnoses, physiological indicators, and lifestyle choices—shapes our mental well-being. By analyzing these multi-faceted connections, the study aims to identify the specific factors that serve as significant indicators of an individual's mental health status.
Each phase of the project contributes to this understanding. The exploratory data analysis serves to uncover hidden correlations and validate health patterns within the large-scale dataset. The regression analysis provides a quantitative method to measure the specific impact of these factors and understand broader trends in mental well-being. The classification model then translates these findings into a practical tool for risk assessment, identifying the thresholds where health data can effectively signal the need for mental health intervention.
Raw Dataset (445,132 rows × 40 features)
↓
Part 1: Data Cleaning & Exploratory Analysis (EDA)
- Deduplication and removal of non-predictive features
- Categorical binning and normalization of long-form descriptions
- Handling missing values and inconsistency filtering
- Outlier Treatment
- Descriptive statistics and correlation analysis
- Research-driven visualization: 6 specific questions addressing health and lifestyle behaviors
- Final Cleaned Dataset: 302,472 rows × 27 features
↓
Part 2: Baseline Regression Modeling
- Standard 80/20 train-test split
- Implementation of baseline Linear Regression
- Performance evaluation (MAE, RMSE, R²)
- Residual analysis and initial feature importance mapping
↓
Part 3: Advanced Feature Engineering & Clustering
- Data scaling, encoding, and Log transformations
- Generating polynomial and interaction features from top coefficients
- Unsupervised clustering: K-Means vs. DBSCAN via Silhouette scores
- PCA-based visualization and cluster profiling
- Final Engineered Dataset: 44 features
↓
Part 4: Model Optimization & Selection
- Comparative training: Linear Regression (re-trained), Random Forest, and Gradient Boosting
- Evaluation against the baseline performance
- Selection of top performer: Gradient Boosting
↓
Part 5: Regression-to-Classification Strategy
- Target distribution analysis (62% zero-value concentration)
- Defining business-rule thresholds for mental health risk tiers
- Visualizing class balance and category distribution
↓
Part 6: Classification & Final Evaluation
- Training Logistic Regression, Random Forest, and Gradient Boosting
- Evaluating performance via Precision, Recall, F1-score, and Support
- Final Selection: Random Forest (optimized for Recall sensitivity)
↓
Final Output: Two Deployment-Ready Models (Regression & Classification)
The data utilized in this project was acquired from the Personal Key Indicators of Heart Disease Kaggle repository, initially curated to analyze personal key indicators of heart disease. However, rather than using the author's pre-processed dataset, this project utilizes the raw, unmodified Behavioral Risk Factor Surveillance System (BRFSS) survey file provided within the same repository. The BRFSS is a prominent annual telephone survey conducted by the CDC. Because this raw dataset contains a vast, unfiltered array of general health, clinical, and behavioral metrics, it provided the flexibility to shift the analytical focus away from heart disease. This inherent versatility naturally established the foundation for the core research question: How do physiological indicators and lifestyle habits influence an individual's Mental Well-being?
The 40 raw features provide a comprehensive view of the respondents' health profiles. They are organized into the following logical domains:
| Category | Description | Features |
|---|---|---|
| Administrative & Demographics | Personal background and location information. | State, Sex, AgeCategory, RaceEthnicityCategory |
| General Health & Physiological | Self-reported overall health and physical metrics. | GeneralHealth, PhysicalHealthDays, MentalHealthDays, HeightInMeters, WeightInKilograms, BMI |
| Clinical Diagnoses | Historical and current medical conditions and chronic diseases. | HadHeartAttack, HadAngina, HadStroke, HadAsthma, HadSkinCancer, HadCOPD, HadDepressiveDisorder, HadKidneyDisease, HadArthritis, HadDiabetes |
| Functional & Mobility | Difficulties related to physical, sensory, and cognitive daily tasks. | DeafOrHardOfHearing, BlindOrVisionDifficulty, DifficultyConcentrating, DifficultyWalking, DifficultyDressingBathing, DifficultyErrands |
| Lifestyle & Behaviors | Daily habits and personal routines impacting health. | PhysicalActivities, SleepHours, SmokerStatus, ECigaretteUsage, AlcoholDrinkers |
| Medical Care & Prevention | Interaction with healthcare services and preventive measures. | LastCheckupTime, ChestScan, HIVTesting, FluVaxLast12, PneumoVaxEver, TetanusLast10Tdap, HighRiskLastYear, CovidPos, RemovedTeeth |
The focal point of this analysis is the MentalHealthDays feature, which is subsequently renamed to poor_mental_health_days during the data refinement phase to improve code readability. This variable records the respondent's answer regarding how many days during the past 30 days their mental health was not good, encompassing factors like stress, depression, and emotional problems.
The structure of this variable makes it an ideal target for a comprehensive machine learning pipeline. During the exploratory data analysis phase, its numerical distribution enables deep statistical correlation testing against the categorical health metrics. For the baseline and advanced regression modeling, its continuous numerical range (spanning from 0 to 30) allows the algorithms to predict specific numeric outcomes based on health indicators. Finally, this continuous nature provides the flexibility needed for the classification phase, allowing us to establish logical business-rule thresholds to convert the numeric scores into distinct mental health risk categories.
A diagnostic review of the raw dataset was performed to identify potential integrity issues, noise, and data quality gaps. The assessment revealed several critical areas requiring attention:
| Feature | Null Count |
|---|---|
AlcoholDrinkers | 42,691 |
BMI | 42,352 |
ECigaretteUsage | 31,835 |
SmokerStatus | 31,636 |
DifficultyErrands | 21,968 |
DifficultyConcentrating | 20,559 |
DifficultyWalking | 20,327 |
DifficultyDressingBathing | 20,229 |
BlindOrVisionDifficulty | 17,882 |
DeafOrHardOfHearing | 16,967 |
RaceEthnicityCategory | 13,736 |
PhysicalHealthDays | 10,900 |
MentalHealthDays (Target) | 9,037 |
AgeCategory | 8,438 |
SleepHours | 5,413 |
HadAngina | 4,379 |
HadHeartAttack | 3,039 |
HadDepressiveDisorder | 2,786 |
HadArthritis | 2,607 |
HadCOPD | 2,193 |
HadKidneyDisease | 1,900 |
HadAsthma | 1,747 |
HadStroke | 1,531 |
GeneralHealth | 1,176 |
PhysicalActivities | 1,069 |
HadDiabetes | 1,061 |
The data refinement phase was designed to transform the noisy raw survey data into a high-signal dataset suitable for machine learning.
Non-predictive features and redundant markers were removed to reduce dimensionality and focus on relevant mental health predictors.
<details> <summary>View removed features and logic</summary>| Category | Features Removed | Reason for Removal |
|---|---|---|
| Administrative | State | Geographic data is outside the scope of this physiological/behavioral study. |
| Clinical Specifics | HadSkinCancer, ChestScan, CovidPos, HIVTesting | Low correlation with the target variable or represents acute rather than chronic health states. |
| Preventive Care | LastCheckupTime, FluVaxLast12, PneumoVaxEver, TetanusLast10Tdap, HighRiskLastYear | These represent healthcare access rather than direct psychological predictors. |
| Redundant Metrics | RemovedTeeth, HeightInMeters, WeightInKilograms | RemovedTeeth provided low signal; physical metrics are encapsulated in the BMI feature. |
A rigorous strategy was applied to handle missing information while preserving the clinical integrity of the dataset.
<details> <summary>View imputation and handling details</summary>MentalHealthDays column were dropped to ensure the model is trained only on verified labels.AgeCategory and SleepHours: Imputed using the Median to maintain central tendency.GeneralHealth and PhysicalActivities: Imputed using the Mode (most frequent value) due to the low percentage of missingness.Categorical features often contained long-form text or non-uniform descriptions (e.g., complex RaceEthnicityCategory labels).
These were mapped and converted into concise, uniform categories to improve model interpretability and prepare for encoding. This ensured that all categorical inputs have consistent labels across the entire dataset.
</details>To ensure data reliability, records containing logical impossibilities or "survey noise" were identified and removed.
<details> <summary>View outlier and contradiction stats</summary>All column names were standardized to snake_case for improved code readability (e.g., MentalHealthDays to poor_mental_health_days). Finally, the dataset was logically reordered for clarity:
sex, age_category, race_ethnicity.bmi, general_health, sleep_hours, physical_activities, smoker_status, e_cigarette_usage, alcohol_drinkers.poor_physical_health_days.had_heart_attack through had_diabetes.deaf_or_hard_of_hearing through difficulty_errands.poor_mental_health_days.An initial distribution analysis revealed a significant "Right Tail" in the target variable, which guided the modeling strategy.
<img src="https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/target_variable_density.png" width="400">To ensure high data quality and model stability, an advanced anomaly detection phase was performed on the numerical features: bmi, sleep_hours, and poor_physical_health_days.
The Isolation Forest algorithm was selected for this task due to its superior ability to detect anomalies in a multi-dimensional space. Unlike standard univariate methods (such as IQR) that only identify outliers on a per-feature basis, Isolation Forest evaluates how features interact. A specific data point might appear normal in isolation but becomes an outlier when its combination with other variables is statistically improbable within the dataset's overall structure.
A 5% contamination threshold was strategically applied. In large-scale, self-reported telephone surveys like the BRFSS, a wide spectrum of diverse data and high variance are naturally expected. This 5% limit acts as a balanced ceiling—it is aggressive enough to purge extreme, high-leverage outliers that would otherwise skew the model, while being conservative enough to preserve the massive sample size required for robust analysis.
<details> <summary>View outlier detection results and impact</summary>bmi feature. The maximum value was reduced from 97.65 (a clinically extreme and statistically rare value that likely represents a data entry error or an extreme outlier) to a more plausible maximum of 54.39. This ensures the model focuses on representative physiological trends rather than extreme noise.<video src="https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/outlier.mp4" autoplay loop muted playsinline width="500"></video>
This section provides a high-level statistical overview of the cleaned dataset, offering insights into the distribution of categorical health indicators and the central tendencies of numerical physiological metrics.
| Feature | Count | Unique | Top | Freq |
|---|---|---|---|---|
sex | 302,472 | 2 | female | 154,084 |
race_ethnicity | 302,472 | 5 | white | 228,656 |
general_health | 302,472 | 5 | very good | 107,603 |
physical_activities | 302,472 | 2 | yes | 238,933 |
smoker_status | 302,472 | 2 | no | 268,007 |
e_cigarette_usage | 302,472 | 2 | no | 286,689 |
alcohol_drinkers | 302,472 | 2 | yes | 168,108 |
had_heart_attack | 302,472 | 2 | no | 287,253 |
had_angina | 302,472 | 2 | no | 285,291 |
had_stroke | 302,472 | 2 | no | 291,049 |
had_asthma | 302,472 | 2 | no | 259,432 |
had_copd | 302,472 | 2 | no | 282,231 |
had_depressive_disorder | 302,472 | 2 | no | 244,610 |
had_kidney_disease | 302,472 | 2 | no | 289,916 |
had_arthritis | 302,472 | 2 | no | 203,135 |
had_diabetes | 302,472 | 4 | no | 254,420 |
deaf_or_hard_of_hearing | 302,472 | 2 | no | 276,837 |
blind_or_vision_difficulty | 302,472 | 2 | no | 288,705 |
difficulty_concentrating | 302,472 | 2 | no | 273,202 |
difficulty_walking | 302,472 | 2 | no | 264,080 |
difficulty_dressing_bathing | 302,472 | 2 | no | 294,920 |
difficulty_errands | 302,472 | 2 | no | 285,994 |
| Feature | Mean | Std | Min | 25% | 50% | 75% | Max |
|---|---|---|---|---|---|---|---|
age_category | 52.91 | 18.06 | 18.00 | 40.00 | 55.00 | 70.00 | 80.00 |
bmi | 28.21 | 5.73 | 12.02 | 24.19 | 27.41 | 31.45 | 54.39 |
sleep_hours | 7.03 | 1.22 | 1.00 | 6.00 | 7.00 | 8.00 | 14.00 |
poor_physical_health_days | 3.11 | 6.97 | 0.00 | 0.00 | 0.00 | 2.00 | 30.00 |
poor_mental_health_days | 3.49 | 7.07 | 0.00 | 0.00 | 0.00 | 3.00 | 30.00 |
Key Findings:
poor_physical_health_days and poor_mental_health_days, reinforcing the intrinsic link between physical ailment and psychological distress.sleep_hours and mental well-being. This indicates that fewer hours of sleep are directly associated with an increase in reported poor mental health days.<img src=https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/Initial_heat_map.png width="400">
This phase of the Exploratory Data Analysis (EDA) moves beyond basic statistics to uncover the complex interactions between lifestyle, physical health, and psychological states. To systematically explore these factors, we have structured our analysis around six core questions, each examining the relationship between the target variable and key factors within the dataset.
Q1: How do BMI and Poor Physical Health Days impact Mental Well-being across different sleep levels?
<img src=https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/Q1_EDA.png width="500">
Q2: How do habits like exercise, smoking, and alcohol consumption interact within General Health categories to shape Mental Well-being?
<img src=https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/Q2_EDA.png width="300">
Q3: How does the distribution of diminished Mental Well-being evolve across age groups for different genders?
<video src="https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/men_vs._women.mp4" autoplay loop muted playsinline width="500"></video>
Q4: How do specific physical ailments and chronic conditions impact Mental Well-being?
<video src="https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/physical_c.mp4" autoplay loop muted playsinline width="500"></video>
Q5: How do ethnicity and physical functional difficulties interact to influence Mental Well-being?
<img src=https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/Q5_EDA.png width="500">
Q6: How does a formal depressive disorder diagnosis correlate with self-reported Mental Well-being?
<video src="https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/clinical_v.mp4" autoplay loop muted playsinline width="500"></video>
The Exploratory Data Analysis has successfully transformed a raw dataset of 445k records into a clean, high-signal foundation of 302,472 observations. Through this multi-dimensional analysis, we have identified that Physical Health Days, General Health Perception, and Sleep Duration are among the most potent predictors of our target variable.
With these insights, we move forward to the Modeling Phase, where we will leverage these behavioral and clinical indicators to build predictive systems capable of identifying individuals at risk of high mental distress.
The primary objective of this phase is to establish a performance benchmark for predicting the number of poor mental health days per month. By implementing a simple, unoptimized Linear Regression, we aim to quantify the linear relationships between our 26 features and the target variable, providing a "baseline" to measure the effectiveness of more complex models later in the pipeline.
Following a methodical data science workflow, the initial setup was kept straightforward to ensure reproducibility:
Feature Selection: All 26 available features from the cleaned dataset were utilized to capture global interactions.
Train-Test Split: A standard 80/20 split was applied using simple random sampling.
Reproducibility: A fixed Random Seed (42) was used to ensure consistent results across different environments.
Implementation: The model was trained using the LinearRegression class from scikit-learn with default parameters.
The initial results from our baseline model confirm that while there is a discernible signal in the data, the relationship between physiological traits and mental health is far from linear.
| Metric | Score | Interpretation |
|---|---|---|
| MAE | 3.6770 | On average, our predictions are off by ~3.7 days. |
| MSE | 34.2292 | Mean Squared Error. |
| RMSE | 5.8506 | Standard deviation of the prediction errors. |
| R² Score | 0.3157 | The model explains approximately 31.6% of the variance. |
Contextual Note: An R² of 0.31 reflects the inherent complexity of our target variable. Predicting human emotions and mental states based on physical indicators is significantly more abstract than predicting mathematical constants or market prices. These results strongly suggest that the data contains non-linear patterns that a simple regression cannot capture.
To understand where the model fails, we analyzed the error patterns through diagnostic visualizations.
<img src=https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/baseline_stage.png width="550">
By examining the model’s coefficients, we can identify which factors the baseline model perceives as the primary drivers of mental well-being.
<video src="https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/coef.mp4" autoplay loop muted playsinline width="600"></video>
The baseline phase has achieved its goal: it mapped the linear landscape of our data and demonstrated its limitations. The relatively low R² and the clear under-prediction of high-distress cases justify our next strategic move: Feature Engineering and the implementation of Non-Linear Ensemble Models to capture the true complexity of human mental health.
The baseline results indicated that linear models struggle to capture the complex, non-linear nature of mental health data. To address this, we implemented a sophisticated data engineering pipeline designed to provide the models with richer contextual intelligence.
poor_mental_health_days (0-30 days), we applied a log transformation. This stabilizes the variance and allows models to better differentiate between varying levels of distress.general_health) were expanded via One-Hot Encoding, resulting in 34 initial features. All numerical data were standard-scaled to prevent unit-bias.A significant emphasis was placed on identifying hidden sub-populations within the data. We performed a rigorous comparison between different clustering paradigms to find the most effective segmentation:
| Algorithm | k / Configuration | Silhouette Score |
|---|---|---|
| K-Means | k=3 | -0.0011 |
| K-Means | k=4 | -0.0053 |
| DBSCAN | - | -0.3257 |
<img src=https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/PCA.png width="400">
To understand who these clusters represent, we performed an anomalous feature detection for each group, measuring how much each feature deviates from the Global Average in terms of Standard Deviations (SD).
Depression x Concentration shows a massive 6.28 SD, highlighting the heavy cumulative weight of these combined conditions.Poor General Health x Concentration Issues reaches a staggering +18.70 SD, while Poor Health x Depression stands at +7.31 SD.To leverage these insights for the modeling phase, we integrated the clustering results back into the main dataset:
Cluster_Mental_Cognitive_Issue, Cluster_Mainstream_Healthy, and Cluster_Extreme_Risk.Distance_to_Centroid feature to quantify the intensity of a respondent's profile (how far they are from the "average" member of their group).Final Engineered Dataset Dimensions: 302,472 records × 44 features.
Baseline Conclusion: This phase transformed abstract data points into categorized health profiles. While these new features provide the upcoming ensemble models with critical "contextual intelligence", they also highlight the difficulty of predicting mental health: even with high-dimensional clusters and interactions, the subtle nuances of human experience remain a challenge to model with perfect accuracy.
In this phase, we evaluated multiple modeling approaches to find the optimal solution for our prediction task. We re-trained the initial Linear Regression model using the newly engineered 44-feature dataset to isolate the direct impact of our data processing. Simultaneously, we trained Random Forest and Gradient Boosting models to capture the non-linear complexities identified during the exploratory phase.
We evaluated the models using a standard 80/20 train-test split. The primary focus was placed on MAE (Mean Absolute Error) as it provides the most interpretable metric for our goal: predicting the actual number of mental health days.
| Model Name | MAE (Days) | RMSE (Days) | R² Score |
|---|---|---|---|
| Initial Baseline (Linear) | 3.6770 | 5.8506 | 0.3157 |
| Linear Regression (Engineered) | 3.0812 | 6.2635 | 0.2157 |
| Random Forest (SKlearn) | 3.1311 | 6.2497 | 0.2192 |
| Gradient Boosting | 3.0391 | 6.2161 | 0.2275 |
At first glance, the decrease in R² and the slight increase in RMSE compared to the initial baseline might seem counterintuitive. However, this is a common outcome when dealing with Log-Transformed targets and highly subjective survey data:
To understand what drives our model's decisions, we visualized the Feature Importance of the winning Gradient Boosting model.
<img src=https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/key_predictors.png width="400">
Depressive Disorder and the respondent's Age Category emerged as the most significant indicators of mental distress days.physical health status and difficulty concentrating.The Gradient Boosting model was selected as the final model for this project. It demonstrated the best ability to learn from its own errors iteratively, resulting in the lowest MAE across all tests. It successfully balanced the impact of clinical history with subtle lifestyle factors and the unsupervised health profiles we identified during clustering.
Since this repository contains the finalized regression model, you can integrate it into your own Python environment by following these steps:
regression_model.pkl.import pickle
# Load the winning model
model_path = "regression_model.pkl"
with open(model_path, "rb") as f:
model = pickle.load(f)
While the regression model provided a detailed granular view of the drivers behind mental health distress, we decided to enhance the project's clinical utility by introducing a Classification perspective. By shifting from predicting specific days to identifying risk levels, we can transform the model into a strategic screening tool focused on Risk Identification.
This dual approach allows us to not only understand the intensity of distress but also to effectively distinguish between individuals who are stable and those who are beginning to experience mental health challenges.
Before training our classifiers, we analyzed the target variable's distribution to determine the most effective split strategy.
Statistical Findings:
Strategic Choice: Business-Rule Threshold
While a Median Split is often preferred to avoid outlier influence, our Probability Density Profile shows that over 62% of participants reported 0 days of poor mental health. This places the median within the "Zero Group," making a standard median split mathematically non-functional (as both sides of the split would fall into the same category).
We therefore implemented a Business Rule Threshold:
This choice provides results in a relatively balanced distribution (approx. 62/38), which is optimal for training our classifiers.
The resulting distribution shows that 62.3% of the participants are categorized as having High Well-being (0 days), while 37.7% fall into the Coping / Challenges (1+ days) group. Although the classes are not extremely skewed, the "Coping" group is under-represented.
<video src="https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/catigorization.mp4" autoplay loop muted playsinline width="400"></video>
Due to this imbalance, Accuracy will not be our primary evaluation metric. A naive model could achieve 62.3% accuracy by simply predicting "High Well-being" for all instances, failing to identify those experiencing challenges.
Therefore, our evaluation will prioritize the Recall score for the "Coping" class.
By focusing on Recall, we ensure that our model acts as a robust safety net for risk detection.
In this stage, we trained three classification models to identify individuals at risk of mental health distress. The evaluation process is designed to find a model that provides a balance between overall accuracy and high sensitivity to the target population.
To assess the effectiveness of our classifiers, we utilized three primary metrics:
Accuracy: Measures the proportion of correct predictions out of total predictions.
Note: While easy to understand, accuracy can be misleading if classes are imbalanced.
Precision: Answers the question: "When the model predicts positive, how often is it correct?"
Note: Focuses on the accuracy of positive flags (minimizing False Positives).
Recall: Answers the question: "Out of all actual positives, how many did we find?"
Note: Focuses on completeness (minimizing False Negatives).
1. Logistic Regression
<div align="center"> <table> <tr> <td width="60%"><img src=https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/cm_Logistic_Regression.png width="300">
</td> <td width="40%" valign="top">| Metric | Score |
|---|---|
| Accuracy | 0.74 |
| Recall (Coping) | 0.52 |
| Precision (Coping) | 0.72 |
2. Gradient Boosting
<div align="center"> <table> <tr> <td width="60%"><img src=https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/cm_Gradient_Boosting.png width="300">
</td> <td width="40%" valign="top">| Metric | Score |
|---|---|
| Accuracy | 0.75 |
| Recall (Coping) | 0.53 |
| Precision (Coping) | 0.73 |
3. Random Forest
<div align="center"> <table> <tr> <td width="60%"><img src=https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/cm_Random_Forest.png width="300">
</td> <td width="40%" valign="top">| Metric | Score |
|---|---|
| Accuracy | 0.71 |
| Recall (Coping) | 0.56 |
| Precision (Coping) | 0.64 |
The evaluation shows distinct trade-offs between the three models based on the prioritized metrics:
<video src="https://huggingface.co/lia-prop13/Physical-Mental-Proxy/resolve/main/recall.mp4" autoplay loop muted playsinline width="500"></video>
The Random Forest model was selected as the final champion for this project. In the context of mental health and screening, Recall is the primary priority. We prioritize minimizing False Negatives (missing people in need) over maintaining high precision. Random Forest provides the most effective safety net by ensuring the highest percentage of people facing challenges are detected and placed on the radar of support systems.
Since this repository contains the finalized classification model, you can integrate it into your own Python environment by following these steps:
classification_model.pkl.import pickle
# Load the winning model
model_path = "classification_model.pkl"
with open(model_path, "rb") as f:
model = pickle.load(f)
This research project represents a comprehensive attempt to map the invisible architecture of mental well-being through physiological and lifestyle metrics. By moving from raw, self-reported survey data to specialized predictive models, we have uncovered critical insights into how our daily physical reality shapes our internal state.
- The Nonlinear Reality of Mental Health: The initial performance of the Linear Baseline served as a statistical indication that human distress does not follow a simple, incremental path. Mental health is a result of complex interactions. As discovered through feature interaction synthesis, when factors like chronic depression and cognitive difficulty overlap, the impact on well-being doesn't just add up—it multiplies. The engineering phase successfully captured these non-linearities, as evidenced by the significant reduction in error metrics.
- The Power of "Hidden Profiles" (Clustering): Through unsupervised clustering, we moved beyond individual variables to identify distinct human profiles. We successfully isolated high-risk groups, such as the "Extreme Multi-morbidity" segment—individuals whose health indicators deviate significantly from the norm. Recognizing these profiles allows for a more nuanced approach than traditional clinical categories, helping us see the person behind the symptoms.
- From Measurement to Prevention: The implementation of both Regression and Classification models provides a dual-layered analytical framework:
- Precision in Intensity: The regression model achieved a refined Mean Absolute Error (MAE) of approximately 3 days. In the context of subjective human emotion, this represents a meaningful level of predictive, allowing for a granular understanding of the magnitude of distress.
- Sensitivity in Risk: The classification model, optimized for Recall, acts as a sensitive safety net. It ensures that the "Coping" population is identified and placed on the radar of support systems, prioritizing the prevention of False Negatives.
- The Bottom Line: By integrating physiological data with behavioral patterns, we have built a framework that bridges the gap between raw data and actionable insights. Together, these models demonstrate an ability to both measure the intensity of distress and identify critical risk thresholds. This synergy could potentially assist health systems in moving from reactive treatment toward proactive intervention, offering a framework to help identify individuals in need before they reach a point of crisis.
While the models provide valuable insights, several limitations should be considered:
To view the complete data analysis, cleaning process, and visualizations in the official IPYNB file, click the button below:
The analysis and modeling were performed using the following Python environment:
# System and utility
import os
import random
import warnings
# Data manipulation
import numpy as np
import pandas as pd
# Visualization libraries
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import plotly.express as px
import plotly.graph_objects as go
import plotly.io as pio
# Machine Learning - Preprocessing, Models & Evaluation
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
from sklearn.linear_model import LinearRegression, LogisticRegression
from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier
from sklearn.metrics import (
mean_absolute_error, mean_squared_error, r2_score,
accuracy_score, precision_score, recall_score, f1_score,
classification_report, confusion_matrix, ConfusionMatrixDisplay
)
# Model serialization
import pickle
Lia Prop | May 2026