Giter Club home page Giter Club logo

airflow-mlflow-example's Introduction

Example DAGs for Data Science and Machine Learning Use Cases

These examples are meant to be a guide/skaffold for Data Science and Machine Learning pipelines that can be implemented in Airflow with MLflow integration.

In an effort to keep the examples easy to follow, much of the data processing and modeling code has intentionally been kept simple.

Examples

  1. mlflow-dag.py - A simple DS pipeline from data extraction to modeling.

    • Pulls data from BigQuery using the Google Provider (BigQueryHook) into a dataframe that preps, trains, and builds the model
    • Data is passed between the tasks using XComs
    • Uses GCS as an Xcom backend to easily track intermediary data in a scalable, external system
    • Trains model with Grid Search
    • Logs model metrics to MLflow.
  2. mlflow-multimodel-dag.py - A simple DS pipeline from data extraction to modeling that leverages the Task Goup API to experiment with multiple models in parallel.

    • This DAG performs the same tasks as example #1 with some additions.
    • Uses Task Groups to configure training multiple models with Grid Search in parallel.
  3. mlflow-multimodel-config-dag.py - A simple DS pipeline from data extraction to modeling that leverages the Task Goup API to experiment with multiple models in parallel.

    • This DAG performs the same tasks as example #2 with the addition of passing optional grid parameters at runtime to the DAG for various models.
  4. mlflow-multimodel-register-dag.py - A simple DS pipeline from data extraction to modeling publication that leverages the Task Goup API to experiment with multiple models in parallel.

    • This DAG performs the same tasks as example #2 with some additions.

    • Selects the best performing model and parameters then fits a final model on the full dataset for publication to the MLflow Model Registry.

    • Sample runtime configs to pass that will override default parameters provided in models.py.

      {
          "lgbm":{
              "learning_rate": [0.01, 0.05, 0.1], 
              "n_estimators": [50, 100],
              "num_leaves": [31, 40],
              "max_depth": [16, 24, 31]
          },
          "log_reg":{
              "penalty": ["l1","l2","elasticnet"],
              "C": [0.001, 0.01, 0.1, 1, 10],
              "solver": ["newton-cg", "lbfgs", "liblinear"]
          }
      }
      

Sample MLFlow Outputs

Runs

image

Plots

image

image

Metrics

image

image

Parameters

image

airflow-mlflow-example's People

Contributors

fhoda avatar davidspek avatar virajmparekh 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.