Real-time Inferencing Service — Training and Registering a Model
Start course
1h 23m

Learn how to operate machine learning solutions at cloud scale using the Azure Machine Learning SDK. This course teaches you to leverage your existing knowledge of Python and machine learning to manage data ingestion, data preparation, model training, and model deployment in Microsoft Azure.

If you have any feedback related to this course, please contact us at

Learning Objectives

  • Create an Azure Machine Learning workspace using the SDK
  • Run experiments and train models using the SDK
  • Optimize and manage models using the SDK
  • Deploy and consume models using the SDK

Intended Audience

This course is designed for data scientists with existing knowledge of Python and machine learning frameworks, such as Scikit-Learn, PyTorch, and Tensorflow, who want to build and operate machine learning solutions in the cloud.


  • Fundamental knowledge of Microsoft Azure
  • Experience writing Python code to work with data using libraries such as Numpy, Pandas, and Matplotlib
  • Understanding of data science, including how to prepare data and train machine learning models using common machine learning libraries, such as Scikit-Learn, PyTorch, or Tensorflow


The GitHub repo for this course, containing the code and datasets used, can be found here: 


We've spent a little time in this course training and registering machine learning models. Now it's time to deploy a model as a real-time service that clients can use to get predictions from new data. We need a trained model to deploy. So the following code below allows us to train and register a model that predicts the likelihood of a clinic patient being diabetic.

So first we import the necessary modules and classes. So we've got an Experiment class, a Model. We've got Pandas, Numpy, Joblib, and the Sklearn relevant modules and classes. So we've got Train Test Split, Decision Tree Classifier, a Roc AUC Score, and a Roc Curve.

Next, we create an Azure ML experiment in our workspace. We then load the diabetes data set. We separate features and labels. And then we split the data into the training set and test set. We then train our decision tree model. We calculate the accuracy and then we log that information. We also calculate the area under the curve and we log it.

Finally, we save the train model, and we complete the run. With the run complete, we can then register the model. And we do so by providing the model path, the model name, provide some tags, properties.

About the Author

Kofi is a digital technology specialist in a variety of business applications. He stays up to date on business trends and technology and is an early adopter of powerful and creative ideas.
His experience covers a wide range of topics including data science, machine learning, deep learning, reinforcement learning, DevOps, software engineering, cloud computing, business & technology strategy, design & delivery of flipped/social learning experiences, blended learning curriculum design and delivery, and training consultancy.