Giter Site home page Giter Site logo

ravi46931 / insurance-premium-mlops Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 5.83 MB

DagsHub: https://dagshub.com/ravikumar46931/insurance-premium-MLOps

Home Page: https://ravi46931.github.io/insurance-premium-MLOps/

Dockerfile 0.37% Python 96.04% PowerShell 3.59%

insurance-premium-mlops's Introduction

Insurance Premium Prediction Application

Overview

This is a machine learning application designed for predicting insurance premiums. The project leverages a variety of tools and frameworks to streamline data management, experiment tracking, and model deployment.

Demo


Insurance-Premium-Streamlit-App

πŸ› οΈ Tools Utilized


  • DVC (Data Version Control): Used for managing and versioning data pipeline.
  • Git: Version control system for tracking code changes.
  • MLflow: Used for tracking the model training and model evaluation.
  • GitHub Actions Server: Used for continuous integration and deployment.
  • Dagshub: Facilitates MLflow experiment tracking and DVC data pipeline.

πŸ›’οΈ Machine Learning Pipeline


Data Ingestion πŸ“₯

The application ingests insurance premium data from the data/insurance.csv data path and saves it into artifacts/DataIngestionArtifacts.

Data Transformation πŸ”§

Data undergoes transformation to prepare it for model training. Transformed data and preprocessing artifacts are saved into artifacts/DataTransformationArtifacts. Preprocessors are also stored in models/.

Model Training πŸ€–

Multiple machine learning models are trained: Linear Regression, Ridge Regression, Lasso Regression, Polynomial Regression, Random Forest, Gradient Boosting, XGBoost, LightGBM, Catboost. The top 4 performing models based on training metrics are selected. Both models and associated metrics are saved into artifacts/ModelTrainerArtifacts. MLflow is used to track model parameters and metrics throughout this process.

Model Evaluation πŸ“Š

The best-performing model on test data is selected and saved into artifacts/ModelEvaluationArtifacts and models/. Model evaluation metrics are tracked using MLflow.

Streamlit App Development πŸ’»

A Streamlit application is developed to allow users to input data and receive predictions from the trained model.

Model Deployment πŸš€

The model is deployend on the AWS EC2 using Docker and Github Action Server.

πŸ“‹ Model tracking with MLFlow


img

πŸ–‡οΈ Data pipeline tracking with DVC


dvc_up dvc_up

πŸ“ Directory Structure


πŸ“‚.github/
└── πŸ“‚workflows/
      └── main.yaml
πŸ“‚docs/
β”œβ”€β”€ πŸ“‚docs/
β”‚     β”œβ”€β”€ index.md
β”‚     └── getting-started.md
β”œβ”€β”€ mkdocs.yml
└── README.md
πŸ“‚src/
β”œβ”€β”€ init.py
β”œβ”€β”€ πŸ“‚components/
β”‚     β”œβ”€β”€ init.py
β”‚     β”œβ”€β”€ data_ingestion.py
β”‚     β”œβ”€β”€ data_transformation.py
β”‚     β”œβ”€β”€ model_trainer.py
β”‚     └── model_evaluation.py
β”œβ”€β”€ πŸ“‚constants/
β”‚     └── init.py
β”œβ”€β”€ πŸ“‚entity/
β”‚     β”œβ”€β”€ init.py
β”‚     β”œβ”€β”€ config_entity.py
β”‚     └── artifact_entity.py
β”œβ”€β”€ πŸ“‚pipeline/
β”‚     β”œβ”€β”€ init.py
β”‚     β”œβ”€β”€ training_pipeline.py
β”‚     └── prediction_pipeline.py
β”œβ”€β”€ πŸ“‚utils/
β”‚     β”œβ”€β”€ init.py
β”‚     └── utils.py
β”œβ”€β”€ πŸ“‚logger/
β”‚     └── init.py
└── πŸ“‚exception/
      └── init.py
πŸ“‚data/
  └── insurance.csv
πŸ“‚experiment/
  └── experiments.ipynb
requirements.txt
requirements_app.txt
setup.py
app.py
main.py
README.md
implement.md
.gitignore
template.py
prediction.py
init_setup.ps1
dvc.yaml
Dockerfile
demo.py
config.json
.dockerignore
.dvcignore

πŸ“ˆ Models


  • Linear Regression
  • Ridge Regression
  • Lasso Regression
  • Polynomial Regression
  • Random Forest
  • Gradient Boosting
  • XGBoost
  • LightGBM
  • Catboost

πŸ–₯️ Installation


πŸ› οΈ Requirements:

  • Python 3.10
  • mkdocs
  • dvc
  • numpy
  • pandas
  • colorama
  • mlflow==2.2.2
  • dagshub
  • scikit-learn
  • xgboost
  • lightgbm
  • catboost
  • streamlit

βš™οΈ Setup


To reproduce the model and run the application:
  1. Clone the repository:

    git clone <repository_url>
    cd <repository_name>

  2. Set up the virtual environment and install the requirements:

    ./init_setup.ps1

  3. Execute the whole pipeline:

    python main.py
    Now run the streamlit app.

🎯 Inference demo


  1. Run the Streamlit app:

    streamlit run app.py

  2. Enter the input values and get prediction

Contributors πŸ‘¨πŸΌβ€πŸ’»


- Ravi Kumar

insurance-premium-mlops's People

Contributors

ravi46931 avatar

Stargazers

Lavish Gangwani avatar Arjo Kundu avatar

Watchers

 avatar

Forkers

happysk skaiphd

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.