Giter VIP home page Giter VIP logo

caca888 / mlflow-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alfozan/mlflow-example

0.0 0.0 0.0 7.11 MB

This repository provides an example of dataset preprocessing, GBRT (Gradient Boosted Regression Tree) model training and evaluation, model tuning and finally model serving (REST API) in a containerized environment using MLflow tracking, projects and models modules.

Python 2.41% Jupyter Notebook 97.54% Dockerfile 0.05%

mlflow-example's Introduction

MLflow Example Project + Notebook

This repository provides an example of dataset preprocessing, model training and evaluation, model tuning and finally model serving (REST API) in a containerized environment using MLflow tracking, projects and models modules.

This project contains an MLflow project that trains a GBRT (Gradient Boosted Regression Tree) model on UC Irvine's Bike Sharing Dataset Data Set and uses a Docker image to capture the dependencies needed to run training and inference code.

Structure of this project

  • MLproject specifies the Docker container environment to run the project and defines command and parameters in entry_points
  • Dockerfile used to build the image referenced by the MLproject
  • requirements.txt: defined python dependencies needed to build training and inference docker image
  • mlflow_project_driver.py: creates an MLflow experiment for model training and tuning and launches MLflow runs in parallel in docker containers.
  • mlflow_model_driver.py: finds best training run and starts a REST API model server based on MLflow Models in docker containers.
  • train.py : contains a file that trains a scikit-learn model and uses MLflow Tracking APIs to log the model and its metadata (e.g., hyperparameters and metrics)
  • data/hour.csv: Bike Sharing Dataset Data Set

Getting started

Prerequisites:

  1. Python 3
  2. Install Docker per instructions at https://docs.docker.com/install/overview/
  3. Install mlflow pip install mlflow

Dockerized model training and training with MLflow:

  1. clone this repo: git clone https://github.com/alfozan/mlflow-example
  2. build the image for the project's Docker container environment: docker build -t mlflow_example -f Dockerfile .
  3. Start training and tracking: python3 mlflow_project_driver.py

Run MLflow tracking UI:

In the same repo directory, run mlflow ui --host 0.0.0.0 --port 5000 UI is accessible at http://localhost:5000/

Dockerized MLflow model serving (REST API)

In the same repo directory, run python3 mlflow_model_driver.py

Inference request:

curl --silent --show-error 'http://localhost:5001/invocations' -H 'Content-Type: application/json' -d '{
    "columns": ["season", "year", "month", "hour_of_day", "is_holiday", "weekday", "is_workingday", "weather_situation", "temperature", "feels_like_temperature", "humidity", "windspeed"],
    "data": [[1, 0, 1, 0, 0, 6, 0, 1, 0.24, 0.2879, 0.81, 0.0000]]
}'

mlflow-example's People

Contributors

alfozan 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.