Getting Started with Azure AI: A Step-by-Step Guide
Table of contents
- Overview of Azure AI Capabilities
- Step 1 - Create an Azure Account
- Step 2 - Create an Azure Machine Learning Workspace
- Step 3 - Provision Compute Resources
- Step 4 - Develop Training Scripts
- Step 5 - Submit Training Jobs
- Step 6 - Deploy Trained Models
- Step 7 - Consume Model Predictions
- Additional Azure AI Capabilities
- Conclusion
- Key Takeaways
Artificial Intelligence is transforming businesses and Azure provides a robust set of AI services to build intelligent applications. This comprehensive guide will walk through the key steps involved in getting started with Azure AI as a developer.
Overview of Azure AI Capabilities
Microsoft Azure offers one of the most comprehensive sets of AI capabilities through integrated services to add cognitive features to applications:
Pre-built AI APIs - Services like Vision, Speech, Language, Knowledge, Search and more to incorporate ready-made cognitive capabilities.
Machine Learning - Tools like Azure Machine Learning, ML Ops and AutoML to develop, deploy, manage and monitor machine learning models.
AI Infrastructure - GPU optimized virtual machines, container services and serverless options to run computation-intensive workloads.
Development Tools - Notebooks, IDE extensions, frameworks, responsible AI tools and other resources to accelerate building solutions.
Trustworthy AI - Capabilities to enhance transparency, fairness, interpretability, robustness and accountability in AI systems.
With this diverse set of managed AI services on Azure, developers can build intelligent apps tailored to their needs without getting bogged down in infrastructure complexities.
Step 1 - Create an Azure Account
To start using Azure AI services, you first need an Azure account which provides authenticated access to Azure resources:
Go to the Azure portal and click on Start Free to create a new account.
Provide your email address and follow the steps to set up an Azure subscription. Azure offers free credit for new users to get started.
Once the account is ready, you can access the Azure dashboard which lists all the available services and resources.
Use the search bar on top to find specific services like "Machine Learning" and the
+ Create
a button to provision new resources.
Step 2 - Create an Azure Machine Learning Workspace
An Azure Machine Learning workspace provides a centralized place to work with all your AI resources. Creating a workspace involves:
From the Azure dashboard, search for Machine Learning and select it.
Click on +Add to create a new workspace. Choose your subscription, and resource group and enter a unique name.
Pick an Azure region closest to your location for lower latency. Review and click
Create
to provision the workspace.
The workspace contains tools to develop, train, deploy and manage machine learning models along with related resources like datasets, experiments, models, endpoints, and pipelines.
Step 3 - Provision Compute Resources
Training machine learning models requires access to substantial computing power. Azure provides different computing options that can be attached to your workspace:
Virtual Machines
From the ML workspace, go to
Compute
->Virtual machines
Click
+New
to create a virtual machine optimized for AI workloads like data science VMs.Choose the VM family, size, workspace image, authentication type and network configuration.
Review and create the VM. You can now use this computer for model training.
Azure Machine Learning Compute
Under
Compute
, selectMachine Learning Compute
Specify a cluster name, VM family, and minimum and maximum nodes for autoscaling.
Additional features like GPU support can also be enabled.
Once created, attach this compute cluster to your workspace to submit machine learning jobs.
Azure Databricks
- Azure Databricks provides a collaborative Apache Spark environment for large-scale data engineering and fast model training.
Step 4 - Develop Training Scripts
The next step is to develop Python or R scripts containing your model training code:
Write code within notebooks in your workspace using sample data.
Fine-tune hyperparameters and preprocess data to train optimized models.
Save the script as a
.py
file that loads data, trains a model and outputs metrics.Use ML frameworks like PyTorch, TensorFlow, sci-kit-learn, XGBoost etc.
Register the best model version to your workspace using MLflow tracking.
This script can then be executed on different compute targets to train models at scale.
Step 5 - Submit Training Jobs
Once your training script is ready, you can submit it as a job to train models leveraging the provisioned compute resources:
In your workspace, go to
Jobs
->Submit new
, attach a compute targetGive it a name and description, and upload the training script and other necessary files.
Under configuration, specify the training environment, dependencies, parameters etc.
Monitor runs in the
Jobs
section as your models start training in the cloud.Register the best-performing model version back to your workspace.
Iterating through runs with different configurations helps create optimized ML models.
Step 6 - Deploy Trained Models
After successfully training machine learning models, you can deploy them as production endpoints for applications:
In your workspace, go to
Endpoints
->+Add endpoint
->+Deploy new real-time endpoint
Give it a name, attach the trained model and select a compute type like ACI or AKS.
Enable data collection, logging, authentication etc. and click
Deploy
.You will get scoring URIs and example code to integrate predictions into apps.
This deploys the model as a production-ready API that client applications can leverage for predictions.
Step 7 - Consume Model Predictions
To leverage the deployed models, apps can send data to the endpoint and process the responses:
The endpoint provides example code in Python, C#, Go, JavaScript etc.
Send properly formatted JSON data to the real-time scoring URI via a POST request.
The endpoint will return predicted values from the model along with metadata.
Embed this prediction logic within websites, mobile apps, bots or other programs.
Continuously re-deploy models as you train improved versions over time.
Additional Azure AI Capabilities
Beyond core machine learning, Azure offers many additional AI services:
Cognitive Services - Pre-built APIs for vision, speech, language, knowledge and search.
Bot Service - Tools to build and deploy intelligent chatbots and virtual agents.
Text Analytics - NLP models for sentiment analysis, key phrase extraction and language detection.
Anomaly Detector - Service to detect anomalies in time-series data.
Personalizer - API to add individualized recommendations into apps.
Infrastructure Services - GPU-optimized VMs, container instances, serverless options and more.
Conclusion
This guide covered the end-to-end workflow for getting started with Azure Machine Learning and AI through hands-on examples.
With its comprehensive set of cognitive services, robust machine learning capabilities and enterprise-grade AI infrastructure, Azure enables developers to build intelligent applications infused with AI and ML.
The flexible and scalable Azure AI platform helps future-proof your solutions while abstracting away underlying complexities. With exponential growth in data and the continuous evolution of algorithms, Azure AI services enable you to harness the power of artificial intelligence.
Key Takeaways
Create an Azure account to access AI services
Provision an Azure ML workspace for unified access to resources
Use compute options like VMs, ML compute and Databricks for training
Develop scripts for model training leveraging ML frameworks
Submit jobs to train models at scale in the cloud
Deploy optimized models as production endpoints
Consume predictions through generated SDKs and docs
Leverage other Azure AI services like Cognitive Services
With this strong foundation, you can start building feature-rich intelligent applications powered by Azure AI!
Subscribe to my newsletter
Read articles from Pratik M directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Pratik M
Pratik M
As an experienced Linux user and no-code app developer, I enjoy using the latest tools to create efficient and innovative small apps. Although coding is my hobby, I still love using AI tools and no-code platforms.