Project Description:
A single Python script that trains a Polynomial Ridge Regression model to predict a wellness index and exposes a Flask API for real-time predictions.
wellTrack/
│
├── wellness\_app.py # All-in-one training + Flask API
├── wellness\_dataset\_cleaned.csv # Dataset
├── requirements.txt # Python dependencies
├── Dockerfile # Docker setup
└── README.md # Project documentation
git clone https://github.com/maheshLEO4/Wellness_Tracker.git
cd wellTrackpip install -r requirements.txt
⚠️ Make sure you’re using Python 3.10+ (recommended).
python wellness_app.pyThe script will automatically:
- Load and clean the dataset
- Train a Polynomial Ridge Regression model
- Save the trained model (
wellness_poly_pipeline.pkl) - Start the Flask API at
http://127.0.0.1:5000/
Request Body (JSON):
{
"features": [age, sleep_hours, phone_use_hours, water_liters, gender_Male, gender_Other]
}Feature Description:
| Feature | Type | Notes |
|---|---|---|
| age | int | Age of the user |
| sleep_hours | float | Average sleep hours |
| phone_use_hours | float | Daily phone usage hours |
| water_liters | float | Daily water intake |
| gender_Male | int | 0 = False, 1 = True |
| gender_Other | int | 0 = False, 1 = True |
Response (JSON):
{
"wellness_index_percentage": 60
}curl -X POST http://127.0.0.1:5000/predict
-H "Content-Type: application/json"
-d '{"features": [34, 7.2, 7.3, 2.4, 0, 0]}'
---
## 6. Docker Deployment
### 6.1 Build Docker Image
```bash
docker build -t wellness-api .
docker run -p 5000:5000 wellness-apiAccess the API at:
http://localhost:5000/predict
- Feature order and number must match the dataset columns.
gender_Maleandgender_Othermust be 0 or 1.- The script is self-contained, so no separate training step is required.