Tech

End to End ML Platform! Are we there yet? (Part 3)
Anu Ganesan
March 3, 2020

 

MLFlow from Databricks 

Databricks have  introduced Managed MLFlow to manage Machine learning projects end-to-end. Once Machine Learning Projects are funded, it starts with Data Engineers analyzing the data and Data Scientists experimenting with models. 

MLFlow enables Data Scientists with Experimentation Tracking where Data Scientists can track model parameters and metrics along with version management.

MLFlow Model Management provides a way to collaborate and share Machine Learning models integrated with approval workflows.

MLFlow lets either ML Engineers or Data Scientists to deploy their ML models with the capability to perform batch inference on Apache SparkTM or as REST API using docker containers.

Azure ML Pipeline from Microsoft 

Azure has different pipelines for different use cases. For instance, ML Pipeline stitches various steps of reusable Machine Learning workflows while Azure Pipeline allows for CI / CD automation of ML workflows.

 

ML Pipeline for building ML workflows

 

Azure Machine Learning SDK enables Data Scientists to create ML Workflows in Python.

import azureml.core

from azureml.core import Workspace

from azureml.pipeline.core import Pipeline, PublishedPipeline

from azureml.core.experiment import Experiment

ws = Workspace.from_config()

experiments = Experiment.list(ws)

for experiment in experiments:

    print(experiment.name)

published_pipelines = PublishedPipeline.list(ws)

for published_pipeline in  published_pipelines:

    print(f"{published_pipeline.name},'{published_pipeline.id}'")

experiment_name = "<<Experiment Name>>" 

pipeline_id = "<<Pipeline ID>>" 

Create Schedule to execute ML workflows using Azure ML Python SDK. Executing ML workflow can be scheduled in below ways:

Time-based

recurring_schedule = Schedule.create(ws, 

name="<<Schedule Name>>", 

description="<<Schedule Description>>",

pipeline_id=pipeline_id,

experiment_name=experiment_name, 

recurrence=recurrence)

Change-based on code change

reactive_schedule = Schedule.create(ws, 

name="<<Schedule Name>>", 

description="<<Schedule Description>>",

pipeline_id=pipeline_id, 

experiment_name=experiment_name, 

datastore=datastore, 

data_path_parameter_name="input_data")

 

Azure Pipeline for CI / CD automation

 

Machine Learning can deploy ML pipelines to one of below mentioned computes using Azure Pipeline

  • Local Compute
  • Azure Container Instance
  • Azure Kubernetes Service

There are 2 ways to build deploy ML models

  • CLI 

            az ml model deploy -m mymodel:1 --ic inferenceconfig.json --dc deploymentconfig.json

  • Python SDK

            from azureml.core.webservice import LocalWebservice, Webservice

            deployment_config = LocalWebservice.deploy_configuration(port=8890)

            service = Model.deploy(ws, "myservice", [model], inference_config, deployment_config)

            service.wait_for_deployment(show_output = True)

            print(service.state)

Every deployed model is provided with a REST endpoint to infer the model.

Additionally, one can enable continuous deployment by just turning on the trigger flag as follows: 

SageMaker from Amazon

 

AWS Step Function interlinks AWS services like AWS Lambda, AWS Fargate, AWS SageMaker to build workflows of your choice either it be an application or process for continuous deployment of ML models. 

{

  "StartAt": "First Step",

  "States": {

    "Deploy": {

      "Type": "Task",

      "Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME",

      "Next": "Second Step"

    }, 

    "Second Step": {

      "Type": "Task",

      "Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME",

      "End": true

    } 

  }

}

AWS Code pipeline, a CI / CD service along with AWS Step Function handling workflow-driven action provides a powerful automation pipeline. 

Successful Deployment Step Function


Part 1 – End to End ML Platform! Are we there yet?

Part 2 – End to End ML Platform! Are we there yet?

Part 4 - End to End ML Platform! Are we there yet?


We hope you found our blog post informative. If you have any project inquiries or would like to discuss your data and analytics needs, please don't hesitate to contact us at info@predera.com. We're here to help! Thank you for reading.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.