Mlflow

Published August 4, 2023

MLflow - Part 1 - Fundamentals

Introduction

MLfLow is an open-source platform for managing workflows and artifacts in the entire machine learning lifecycle.

Table of content

  1. Example
    1. Installation

Example

In this example a ML project is going to be created using the benefits of MLflow.

Installation of MLflow

Create conda environment

conda create  --name mlflow_fundamentals

Actvate environment

conda activate mlflow_fundamentals

Install Mlflow

conda install -c conda-forge mlflow

Example

import mlflow

from sklearn.model_selection import train_test_split
from sklearn.datasets import load_diabetes
from sklearn.ensemble import RandomForestRegressor

mlflow.autolog()

db = load_diabetes()
X_train, X_test, y_train, y_test = train_test_split(db.data, db.target)

# Create and train models.
rf = RandomForestRegressor(n_estimators=100, max_depth=6, max_features=3)
rf.fit(X_train, y_train)

# Use the model to make predictions on the test dataset.
predictions = rf.predict(X_test)

Run MLflow ui

mlflow ui

Check http://localhost:5000 to review the runners.

mlflowui1

Previous Post: Softmax