https://birth-weight-predictor-3-g60m.onrender.com
A production-ready Machine Learning web application that predicts a babyβs birth weight (in ounces) using maternal and pregnancy-related features.
This project demonstrates the complete ML lifecycle: Data Collection β Data Preprocessing β EDA β Model Training β Model Serialization β Flask API Integration β Frontend Development β Deployment on Render.
- Source: Kaggle
- File Used:
babies.csv
The dataset contains maternal and pregnancy-related attributes used to predict birth weight.
| Feature | Description |
|---|---|
| Gestation | Length of pregnancy (days) |
| Parity | 0 = First pregnancy |
| Age | Motherβs age (years) |
| Height | Motherβs height (inches) |
| Weight | Motherβs weight (pounds) |
| Smoke | 1 = Smoker, 0 = Non-smoker |
| Bwt | Birth weight (ounces) β Target Variable |
- Checked dataset structure and data types
- Handled missing values
- Removed duplicate records
- Performed correlation analysis
- Selected relevant features
Libraries Used:
- Pandas
- NumPy
- Matplotlib
- Distribution visualization
- Correlation heatmap
- Smoking impact on birth weight
- Gestation vs Birth weight analysis
Used train_test_split() from Scikit-learn.
- Linear Regression (Baseline Model)
- Lasso Regression (L1 Regularization)
- Ridge Regression (L2 Regularization)
Regularization techniques were applied to reduce overfitting and improve generalization.
Models were compared using:
- RMSE (Root Mean Squared Error)
- RΒ² Score
The best-performing model was selected for deployment.
The final trained model was saved as:
model/model.pkl
Using:
pickle.dump()
The trained model is integrated into a Flask web application.
- Load serialized model using
pickle.load() - Accept user input via HTML form
- Convert input into Pandas DataFrame
- Generate prediction using
model.predict() - Return result to frontend
The application is deployed using:
- GitHub (Version Control)
- Render (Cloud Hosting)
- Gunicorn (Production WSGI Server)
gunicorn app:app
- Python
- Pandas
- NumPy
- Scikit-learn
- Flask
- HTML
- CSS
- Gunicorn
- Render
Machine_learning_model/ β βββ datasets/ β βββ babies.csv βββ model/ β βββ model.pkl βββ templates/ β βββ index.html βββ app.py βββ model_training.ipynb βββ requirements.txt
Ramesh Kumar
Data Science & Machine Learning Enthusiast