SlideShare a Scribd company logo
Use MLflow to manage and deploy Machine Learning model on Spark
Building a model
Building a
model
Building
a model
Data ingestion Data analysis
Data
transformation
Data validation Data splitting
Trainer
Model
validation
Training
at scale
LoggingRoll-out Serving Monitoring
Train Model Validate Model Deploy ModelPackage Model Monitor Model
Retrain Model
Use MLflow to manage and deploy Machine Learning model on Spark
Use MLflow to manage and deploy Machine Learning model on Spark
Use MLflow to manage and deploy Machine Learning model on Spark
模型追蹤:記錄和查詢模型訓練的資料,如Accuracy 和各種參數
專案管理:將模型封裝在 pipeline 中,以便與可重複執行
模型管理:管理模型部署並提供 呼叫 API
Use MLflow to manage and deploy Machine Learning model on Spark
Use MLflow to manage and deploy Machine Learning model on Spark
Use MLflow to manage and deploy Machine Learning model on Spark
Use MLflow to manage and deploy Machine Learning model on Spark
Amazon S3
Azure Blob Storage
Google Cloud Storage
FTP server
SFTP Server
NFS
HDFS
mlflow server --backend-store-uri /home/hermanwu/mlflowdata --default-artifact-root
wasbs://artifacts@hmlflow.blob.core.windows.net --host 13.75.XXX.XXX
export
AZURE_STORAGE_ACCESS_KEY=ukmcWZA1l9ZK1M17V/SfHXzQN7jRL5+/I8KAIk2Mjwe
emCFSmBJ85V18kz7Qvt7Aj5JihKxxxxxxxxxxxxxx==
mlflow.set_tracking_uri(). [remote tracking URIs]
Local file path (specified as file:/my/local/dir)
Database encoded as
<dialect>+<driver>://<username>:<password>@<host>:<port>/<d
atabase
MLFlow tracking server (specified as https://my-server:5000
Databricks workspace (specified as databricks or as
databricks://<profileName>e.
Framework Metrics Parameters Tags Artifacts
Keras
Training loss; validation
loss; user-specified
metrics
Number of layers;
optimizer name;
learning rate;
epsilon
Model
summary
MLflow Model (Keras
model), TensorBoard logs; on
training end
tf.keras
Training loss; validation
loss; user-specified
metrics
Number of layers;
optimizer name;
learning rate;
epsilon
Model
summary
MLflow Model (Keras
model), TensorBoard logs; on
training end
tf.estimator TensorBoard metrics – –
MLflow Model (TF saved
model); on call
to tf.estimator.export_saved_
model
TensorFlow
Core
All tf.summary.scalar cal
ls
– – –
“
”
“
”
Use MLflow to manage and deploy Machine Learning model on Spark
Use MLflow to manage and deploy Machine Learning model on Spark
mlflow run sklearn_elasticnet_wine -P alpha=0.5
mlflow run https://github.com/mlflow/mlflow-example.git -P alpha=5
Use MLflow to manage and deploy Machine Learning model on Spark
Use MLflow to manage and deploy Machine Learning model on Spark
❖ Custom Flavors
Use MLflow to manage and deploy Machine Learning model on Spark
mlflow models --help
mlflow models serve --help
mlflow models predict --help
mlflow models build-docker --help
azure_image, azure_model = mlflow.azureml.build_image(model_uri="<path-to-model>",
workspace=azure_workspace,
description="Wine regression model 1",
synchronous=True)
webservice_deployment_config = AciWebservice.deploy_configuration()
webservice = Webservice.deploy_from_image(
image=azure_image, workspace=azure_workspace, name="<deployment-name>")
webservice.wait_for_deployment()
“
”
pyfunc_udf = mlflow.pyfunc.spark_udf(<path-to-model>)
df = spark_df.withColumn("prediction", pyfunc_udf(<features>))
%%PySpark
import mlflow
from mlflow import pyfunc
pyfunc_udf = mlflow.pyfunc.spark_udf(<path-to-model>)
spark.udf.register("pyfunc ", pyfunc_udf )
%%SQL
SELECT
id,
pyfunc(
feature01,
feature02,
feature03,
…..
) AS prediction
FROM tempPredict
LIMIT 20
df.createOrReplaceTempView(“tempPredict")
MLFLOW_TRACKING_URI=http://0.0.0.0:5000 mlflow sklearn serve 
--port 5001 
--run_id XXXXXXXXXXXXXXXXXXXXXX 
--model-path model
curl -X POST 
http://127.0.0.1:5001/invocations 
-H 'Content-Type: application/json' 
-d '[
{
“XXX": 1.111,
“YYYY": 1.22,
“ZZZZ": 1.888
}
]'
mlflow models serve -m runs:/<RUN_ID>/model --port 5050
mlflow
mlflow.azureml
mlflow.entities
mlflow.h2o
mlflow.keras
mlflow.mleap
mlflow.models
mlflow.onnx
mlflow.projects
mlflow.pyfunc
Filesystem format
Inference API
Creating custom Pyfunc models
mlflow.pytorch
mlflow.sagemaker
mlflow.sklearn
mlflow.spark
mlflow.tensorflow
mlflow.tracking
mlflow_client
mlflow_create_experiment
mlflow_delete_experiment
mlflow_delete_run
mlflow_delete_tag
mlflow_download_artifacts
mlflow_end_run
mlflow_get_experiment
mlflow_get_metric_history
mlflow_get_run
mlflow_get_tracking_uri
mlflow_id
mlflow_list_artifacts
mlflow_list_experiments
mlflow_list_run_infos
mlflow_load_flavor
mlflow_load_model
mlflow_log_artifact
mlflow_log_batch
mlflow_log_metric
mlflow_log_model
mlflow_log_param
mlflow_param
mlflow_predict
mlflow_rename_experiment
mlflow_restore_experiment
mlflow_restore_run
mlflow_rfunc_serve
mlflow_run
mlflow_save_model.crate
mlflow_search_runs
mlflow_server
mlflow_set_experiment_tag
mlflow_set_experiment
mlflow_set_tag
mlflow_set_tracking_uri
mlflow_source
mlflow_start_run
mlflow_ui
Create Experiment
List Experiments
Get Experiment
Delete Experiment
Restore Experiment
Update Experiment
Create Run
Delete Run
Restore Run
Get Run
Log Metric
Log Batch
Set Experiment Tag
Set Tag
Delete Tag
Log Param
Get Metric History
Search Runs
List Artifacts
Update Run
Data Structures
Use MLflow to manage and deploy Machine Learning model on Spark
Use MLflow to manage and deploy Machine Learning model on Spark
Use MLflow to manage and deploy Machine Learning model on Spark
Logging Runtimes Performance
https://databricks.com/blog/2019/03/28/mlflow-v0-9-0-features-sql-backend-projects-in-docker-and-customization-in-python-models.html
Search Runtime Performance
https://databricks.com/blog/2019/03/28/mlflow-v0-9-0-features-sql-backend-projects-in-docker-and-customization-in-python-models.html
Use MLflow to manage and deploy Machine Learning model on Spark
Use MLflow to manage and deploy Machine Learning model on Spark
Use MLflow to manage and deploy Machine Learning model on Spark
Use tempfile.TemporaryDirectory + mlflow.log_artifacts
To upload artifices
with TemporaryDirectory(prefix='temp_arti_', dir='temp_artifacts') as dirname:
……
(create artifcats )
……..
mlflow.log_artifacts(dirname)
Train model Validate
model
Deploy
model
Monitor
model
Retrain model
Model reproducibility Model retrainingModel deploymentModel validation
Build appCollaborate Test app Release app Monitor app
ML DevOps integration
App developer
using DevOps Services
Data scientist using
Machine Learning
Use MLflow to manage and deploy Machine Learning model on Spark
Use MLflow to manage and deploy Machine Learning model on Spark
A M L & M L F L O W M O D E L S
The mlflow.azureml module can export python_function models as Azure ML compatible models.
It can also be used to directly deploy and serve models on Azure ML, provided the environment has been correctly
set up.
▪ export the model in Azure ML-compatible format. MLflow will output a directory with the dependencies
necessary to deploy the model.
▪ deploy deploys the model directly to Azure ML.
You first need to set up your environment to work with the Azure ML CLI.
You also have to set up all accounts required to run and deploy on Azure ML. Where the model is deployed is
dependent on your active Azure ML environment. If the active environment is set up for local deployment, the
model will be deployed locally in a Docker container (Docker is required).
mlflow.azureml.build_image(model_path, workspace, run_id=None,image_name=None,
model_name=None,mlflow_home=None, description=None, tags=None, synchronous=True)
▪ Experiment Tracking
▪ MLflow lets you run experiments with any ML library, framework, or language, and automatically keeps track of
parameters, results, code, and data from each experiment so that you can compare results and find the best
performing runs.
▪ With Managed MLflow on Databricks, you can now track, share, visualize, and manage experiments securely from
within the Databricks Workspace and notebooks.
▪ Reproducible Projects
▪ MLflow lets you package projects with a standard format that integrates with Git and Anaconda and capture
dependencies like libraries, parameters, and data.
▪ With Managed MLflow on Databricks, now you can quickly launch reproducible runs remotely from your laptop as a
Databricks job.
▪ Productionize models faster
▪ MLflow lets you quickly deploy production models for batch inference on Apache SparkTM, or as REST APIs using
built-in integration with Docker containers, Azure ML, or Amazon SageMaker.
▪ With Managed MLflow on Databricks, now you can operationalize and monitor production models using Databricks
Jobs Scheduler and auto-managed Clusters to scale as needed based on business needs.
A M L & D A T A B R I C K S
Choose only one option
Easily install the AML Python SDK in the
Azure Databricks clusters and use it for:
✓ logging training run metrics
✓ containerize Spark ML models
✓ deploy them into ACI or AKS

More Related Content

PDF
Introduction to MLflow
PDF
"Managing the Complete Machine Learning Lifecycle with MLflow"
PPTX
MLOps and Data Quality: Deploying Reliable ML Models in Production
PDF
What is MLOps
PDF
MLflow: A Platform for Production Machine Learning
PPTX
Pythonsevilla2019 - Introduction to MLFlow
PDF
Advanced MLflow: Multi-Step Workflows, Hyperparameter Tuning and Integrating ...
PDF
mlflow: Accelerating the End-to-End ML lifecycle
Introduction to MLflow
"Managing the Complete Machine Learning Lifecycle with MLflow"
MLOps and Data Quality: Deploying Reliable ML Models in Production
What is MLOps
MLflow: A Platform for Production Machine Learning
Pythonsevilla2019 - Introduction to MLFlow
Advanced MLflow: Multi-Step Workflows, Hyperparameter Tuning and Integrating ...
mlflow: Accelerating the End-to-End ML lifecycle

What's hot (20)

PDF
MLOps for production-level machine learning
PPTX
Site (Service) Reliability Engineering
PDF
MLFlow: Platform for Complete Machine Learning Lifecycle
PDF
Ml ops intro session
PDF
MLOps Using MLflow
PPTX
1 - Introduction of Azure DevOps
PPTX
MLOps.pptx
PDF
Apply MLOps at Scale by H&M
PDF
Using MLOps to Bring ML to Production/The Promise of MLOps
PDF
“Houston, we have a model...” Introduction to MLOps
PDF
LanGCHAIN Framework
PDF
MLOps by Sasha Rosenbaum
PDF
AI and ML Series - Introduction to Generative AI and LLMs - Session 1
PDF
What is langchain
PPTX
Episode 2: The LLM / GPT / AI Prompt / Data Engineer Roadmap
PDF
Introduction to MuleSoft
PDF
Seamless MLOps with Seldon and MLflow
PDF
Basics of Generative AI: Models, Tokenization, Embeddings, Text Similarity, V...
PPTX
Introduction to API Led connectivity
PDF
BigQuery ML - Machine learning at scale using SQL
MLOps for production-level machine learning
Site (Service) Reliability Engineering
MLFlow: Platform for Complete Machine Learning Lifecycle
Ml ops intro session
MLOps Using MLflow
1 - Introduction of Azure DevOps
MLOps.pptx
Apply MLOps at Scale by H&M
Using MLOps to Bring ML to Production/The Promise of MLOps
“Houston, we have a model...” Introduction to MLOps
LanGCHAIN Framework
MLOps by Sasha Rosenbaum
AI and ML Series - Introduction to Generative AI and LLMs - Session 1
What is langchain
Episode 2: The LLM / GPT / AI Prompt / Data Engineer Roadmap
Introduction to MuleSoft
Seamless MLOps with Seldon and MLflow
Basics of Generative AI: Models, Tokenization, Embeddings, Text Similarity, V...
Introduction to API Led connectivity
BigQuery ML - Machine learning at scale using SQL
Ad

Similar to Use MLflow to manage and deploy Machine Learning model on Spark (20)

PDF
Mlflow with databricks
PDF
MLflow with Databricks
PDF
Running Apache Spark Jobs Using Kubernetes
PPTX
Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...
PDF
MLflow: Infrastructure for a Complete Machine Learning Life Cycle with Mani ...
PPTX
Azure machine learning service
PDF
Trenowanie i wdrażanie modeli uczenia maszynowego z wykorzystaniem Google Clo...
PDF
I want my model to be deployed ! (another story of MLOps)
PDF
Managing the Machine Learning Lifecycle with MLOps
PDF
Kostiantyn Bokhan, N-iX. CD4ML based on Azure and Kubeflow
PDF
Utilisation de MLflow pour le cycle de vie des projet Machine learning
PDF
Processing Large Datasets for ADAS Applications using Apache Spark
PDF
MLFlow 1.0 Meetup
PDF
MLOps pipelines using MLFlow - From training to production
PDF
GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...
PDF
Hopsworks Feature Store 2.0 a new paradigm
PDF
Hamburg Data Science Meetup - MLOps with a Feature Store
PDF
Vertex AI - Unified ML Platform for the entire AI workflow on Google Cloud
PDF
MLflow Model Serving
PDF
Whats new in_mlflow
Mlflow with databricks
MLflow with Databricks
Running Apache Spark Jobs Using Kubernetes
Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...
MLflow: Infrastructure for a Complete Machine Learning Life Cycle with Mani ...
Azure machine learning service
Trenowanie i wdrażanie modeli uczenia maszynowego z wykorzystaniem Google Clo...
I want my model to be deployed ! (another story of MLOps)
Managing the Machine Learning Lifecycle with MLOps
Kostiantyn Bokhan, N-iX. CD4ML based on Azure and Kubeflow
Utilisation de MLflow pour le cycle de vie des projet Machine learning
Processing Large Datasets for ADAS Applications using Apache Spark
MLFlow 1.0 Meetup
MLOps pipelines using MLFlow - From training to production
GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...
Hopsworks Feature Store 2.0 a new paradigm
Hamburg Data Science Meetup - MLOps with a Feature Store
Vertex AI - Unified ML Platform for the entire AI workflow on Google Cloud
MLflow Model Serving
Whats new in_mlflow
Ad

More from Herman Wu (15)

PDF
ML-Ops how to bring your data science to production
PDF
Deep Learning at Scale
PDF
運用MMLSpark 來加速Spark 上 機器學習專案
PDF
運用CNTK 實作深度學習物件辨識 Deep Learning based Object Detection with Microsoft Cogniti...
PDF
運用對話機器人提供線上客服服務
PDF
Bot Framework & Azure cognitive service簡介
PDF
選擇正確的Solution 來建置現代化的雲端資料倉儲
PDF
Azure Data Lake 簡介
PDF
Azure HDInsight 介紹
PDF
Azure 機器學習 - 使用Python, R, Spark, CNTK 深度學習
PDF
Azure Machine Learning using R
PDF
貫通物聯網每一哩路 with Microsfot Azure IoT Sutie
PDF
物聯網應用全貌以及微軟全球案例
PPTX
Windows phone發展概況 2013Q3
PDF
好的Windows Phone App 主要特色 (注意事項)
ML-Ops how to bring your data science to production
Deep Learning at Scale
運用MMLSpark 來加速Spark 上 機器學習專案
運用CNTK 實作深度學習物件辨識 Deep Learning based Object Detection with Microsoft Cogniti...
運用對話機器人提供線上客服服務
Bot Framework & Azure cognitive service簡介
選擇正確的Solution 來建置現代化的雲端資料倉儲
Azure Data Lake 簡介
Azure HDInsight 介紹
Azure 機器學習 - 使用Python, R, Spark, CNTK 深度學習
Azure Machine Learning using R
貫通物聯網每一哩路 with Microsfot Azure IoT Sutie
物聯網應用全貌以及微軟全球案例
Windows phone發展概況 2013Q3
好的Windows Phone App 主要特色 (注意事項)

Recently uploaded (20)

PPTX
A Presentation on Artificial Intelligence
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Cloud computing and distributed systems.
PDF
Approach and Philosophy of On baking technology
PDF
Electronic commerce courselecture one. Pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Big Data Technologies - Introduction.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
A Presentation on Artificial Intelligence
MIND Revenue Release Quarter 2 2025 Press Release
A comparative analysis of optical character recognition models for extracting...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Assigned Numbers - 2025 - Bluetooth® Document
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Cloud computing and distributed systems.
Approach and Philosophy of On baking technology
Electronic commerce courselecture one. Pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Network Security Unit 5.pdf for BCA BBA.
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Spectroscopy.pptx food analysis technology
Big Data Technologies - Introduction.pptx
MYSQL Presentation for SQL database connectivity
sap open course for s4hana steps from ECC to s4
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx

Use MLflow to manage and deploy Machine Learning model on Spark