Skip to content

Ramesh8dsaiml/Birth-weight-predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Birth-weight-predictor web application

End-to-End Machine Learning Web Application

Web Interface

{E845443C-DEDA-4B01-86F4-F975262CA58D}

Deployment (Render)

{610E850D-E0A7-4852-886A-53D25D171B53} image

Live Application:

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.


Dataset Information

  • Source: Kaggle
  • File Used: babies.csv

The dataset contains maternal and pregnancy-related attributes used to predict birth weight.

Features Used:

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

Data Preprocessing

  • Checked dataset structure and data types
  • Handled missing values
  • Removed duplicate records
  • Performed correlation analysis
  • Selected relevant features

Libraries Used:

  • Pandas
  • NumPy
  • Matplotlib

Exploratory Data Analysis (EDA)

  • Distribution visualization
  • Correlation heatmap
  • Smoking impact on birth weight
  • Gestation vs Birth weight analysis

Model Development

Train-Test Split

Used train_test_split() from Scikit-learn.

Algorithms Implemented

  • Linear Regression (Baseline Model)
  • Lasso Regression (L1 Regularization)
  • Ridge Regression (L2 Regularization)

Regularization techniques were applied to reduce overfitting and improve generalization.

Model Evaluation

Models were compared using:

  • RMSE (Root Mean Squared Error)
  • RΒ² Score

The best-performing model was selected for deployment.

Model Serialization

The final trained model was saved as:

model/model.pkl

Using:

pickle.dump()

ML API Integration (Flask)

The trained model is integrated into a Flask web application.

API Workflow:

  1. Load serialized model using pickle.load()
  2. Accept user input via HTML form
  3. Convert input into Pandas DataFrame
  4. Generate prediction using model.predict()
  5. Return result to frontend

Deployment

The application is deployed using:

  • GitHub (Version Control)
  • Render (Cloud Hosting)
  • Gunicorn (Production WSGI Server)

Start Command Used:

gunicorn app:app

Tech Stack

  • Python
  • Pandas
  • NumPy
  • Scikit-learn
  • Flask
  • HTML
  • CSS
  • Gunicorn
  • Render

Project Structure

Machine_learning_model/ β”‚ β”œβ”€β”€ datasets/ β”‚ └── babies.csv β”œβ”€β”€ model/ β”‚ └── model.pkl β”œβ”€β”€ templates/ β”‚ └── index.html β”œβ”€β”€ app.py β”œβ”€β”€ model_training.ipynb β”œβ”€β”€ requirements.txt

Author

Ramesh Kumar
Data Science & Machine Learning Enthusiast

About

πŸ€– End-to-End Machine Learning Web Application for Birth Weight Prediction

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors