Giter Site home page Giter Site logo

sahilchowkekar / wine-quality-prediction-with-mlflow Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 317 KB

License: MIT License

Python 8.54% Jupyter Notebook 16.76% Dockerfile 0.05% CSS 70.80% JavaScript 0.39% HTML 3.46%
aws aws-ec2 aws-ecr dagshub docker machine-learning mlfow mlops python aws-iam

wine-quality-prediction-with-mlflow's Introduction

Wine Quality Prediction with MLflow

This project demonstrates wine quality prediction using machine learning techniques and manages the experiment tracking and model deployment using MLflow. The dataset contains various features related to the chemical composition of wines and their corresponding quality ratings.

Table of Contents

Introduction

In this project, we utilize machine learning algorithms to predict the quality of wines based on their chemical attributes. MLflow is used to manage the end-to-end machine learning lifecycle, including experiment tracking, model development, and deployment.

Features

The Wine Quality Prediction model utilizes a set of chemical attributes as features to predict the quality of wines. The features used in this project include:

  • Fixed Acidity: The amount of fixed acids in the wine.
  • Volatile Acidity: The amount of volatile acids in the wine, which contribute to its odor.
  • Citric Acid: The amount of citric acid present in the wine.
  • Residual Sugar: The amount of residual sugar left after fermentation.
  • Chlorides: The level of salt present in the wine.
  • Free Sulfur Dioxide: The amount of sulfur dioxide that is not bound to other molecules.
  • Total Sulfur Dioxide: The total amount of sulfur dioxide in the wine.
  • Density: The density of the wine.
  • pH: The pH level, which indicates the acidity or alkalinity of the wine.
  • Sulphates: The amount of sulfur compounds present in the wine.
  • Alcohol: The alcohol content of the wine.
    These features are used to train the machine learning model and make predictions about the quality of the wine. The dataset containing these features has been preprocessed and split into training and testing sets for model training and evaluation.

Technology Used

This project leverages various technologies to achieve its goals:

  • Programming Language: Python

  • MLflow: MLflow is employed for experiment tracking, model versioning, and deployment. It allows us to seamlessly manage the end-to-end machine learning lifecycle.

  • Dagshub: Dagshub is used for experiment tracking and collaboration, providing an integrated platform to log experiments and share results.

  • FastAPI: A modern, fast web framework for building APIs with Python.

  • Docker: A platform to develop, ship, and run applications in containers.

  • Amazon Web Services (AWS): A cloud computing platform that provides various services and tools to facilitate deployment and management of applications.

    • AWS Identity and Access Management (IAM): Used to manage access to AWS resources securely.
    • Elastic Container Registry (ECR): A managed container registry to store, manage, and deploy Docker container images.
    • Amazon Elastic Compute Cloud (Amazon EC2): Provides scalable compute capacity in the cloud, often used to host applications and services.

These technologies collectively enable us to efficiently develop, evaluate, and deploy machine learning models for wine quality prediction.

Installation

  1. Clone the repository:
git clone https://github.com/SahilChowkekar/Wine-Quality-Prediction-with-MLflow.git
  1. Navigate to the project directory:
cd Wine-Quality-Prediction-with-MLflow
  1. Create a conda environment after opening the repository:
conda create -n mlops python=3.8 -y
  1. Activate the conda environment:
conda activate mlops
  1. Install the required dependencies:
pip install -r requirements.txt
  1. Finally, run the following command to start the application:
python app.py
  1. Open your preferred web browser and visit:
http://localhost:8080

MLflow Tracking

To integrate MLflow tracking with dagshub, follow these steps:

  1. Log in to dagshub and connect your account to GitHub.
  2. Connect to your repository and add access.
  3. Click on the selected repository for the project name and connect to it.
  4. Go to "Remote" and click on "Experiment".
  5. Copy the MLflow training command provided.
    MLFLOW_TRACKING_URI=https://dagshub.com/SahilChowkekar/End-to-end-Machine-Learning-Project-with-MLflow.mlflow
    MLFLOW_TRACKING_USERNAME=SahilChowkekar
    MLFLOW_TRACKING_PASSWORD=1dc4f330b0a4f858969f6cee768b6252ac0bdbf8
    python script.py

Make changes in the "export as env variables" command according to your information:

Run this to export as env variables:

export MLFLOW_TRACKING_URI=https://dagshub.com/SahilChowkekar/End-to-end-Machine-Learning-Project-with-MLflow.mlflow

export MLFLOW_TRACKING_USERNAME=SahilChowkekar 

export MLFLOW_TRACKING_PASSWORD=1dc4f330b0a4f858969f6cee768b6252ac0bdbf8

AWS CICD Deployment with Github Actions

This repository provides instructions and steps to deploy an application using AWS services and GitHub Actions for continuous integration and continuous deployment (CI/CD).

1. Login to AWS console

Login to your AWS console using your credentials.

2. Create IAM user for deployment

Create an IAM user with specific access for deployment purposes, including EC2 and ECR access. Attach the following policies:

  • AmazonEC2ContainerRegistryFullAccess
  • AmazonEC2FullAccess

3. Create ECR repo to store/save Docker image

Create an Elastic Container Registry (ECR) repository to store your Docker image. Save the repository URI, e.g., 062582090401.dkr.ecr.us-east-2.amazonaws.com/text-s.

4. Create EC2 machine (Ubuntu)

Create an EC2 instance with the Ubuntu operating system.

5. Install Docker in EC2 Machine

Connect to your EC2 instance and install Docker:

sudo apt-get update -y
sudo apt-get upgrade
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker ubuntu
newgrp docker

6. Configure EC2 as self-hosted runner

Go to your repository settings in GitHub, navigate to Actions, and set up a new self-hosted runner. Choose the appropriate OS and follow the provided commands

7. Setup GitHub secrets

In your GitHub repository, go to Settings > Secrets and add the following secrets:

  • AWS_ACCESS_KEY_ID: Your AWS access key ID.
  • AWS_SECRET_ACCESS_KEY: Your AWS secret access key.
  • AWS_REGION: The AWS region you are using (e.g., us-east-2).
  • AWS_ECR_LOGIN_URI: The ECR login URI (e.g., 062582090401.dkr.ecr.us-east-2.amazonaws.com/text-s).
  • ECR_REPOSITORY_NAME: The name of your ECR repository (e.g., textsummary-app).

Now, your GitHub Actions workflows can securely access the required AWS resources using these secrets.

Feel free to follow these steps to set up a seamless CI/CD pipeline for deploying your application using AWS services and GitHub Actions.

Please make sure to review and adjust the content as needed, especially the specific AWS resource names and regions based on your project.

Preview of Wine Quality Prediction in Action

Here's a preview of the Wine Quality Prediction in action:

Home Screenshot

Result Screenshot

License

This project is licensed under the MIT License. See the LICENSE file for more details.

wine-quality-prediction-with-mlflow's People

Contributors

sahilchowkekar avatar

Watchers

 avatar

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.