AI-900: Microsoft Azure AI Fundamentals Lab Exercises
repository·main·Indexed 18 days ago
https://github.com/microsoftlearning/ai-900-aifundamentalsHands-on lab exercises for the AI-900: Microsoft Azure AI Fundamentals course and Microsoft Learn modules. Includes practical guides for provisioning Azure AI Content Safety resources, creating Azure Machine Learning workspaces, using Automated Machine Learning (AutoML) for regression tasks, deploying models as web services, and building data transformation pipelines in Azure Machine Learning Designer.
What's inside ai-900-aifundamentals
- The Azure AI Vision service provides Optical Character Recognition (OCR) capabilities. The Read API is specifically optimized for larger documents and supports both printed and handwritten text. It operates asynchronously to detect and interpret text within an image.
What is K-Means clustering?
mainK-Means is a clustering algorithm that groups data observations into K number of clusters. It works by:
- Initializing K coordinates as randomly selected points called centroids in n-dimensional space.
- Plotting feature vectors as points and assigning each point to its closest centroid.
- Moving the centroids to the center (the mean) of the points allocated to them.
- Reassigning points to the new closest centroids.
- Repeating these steps until cluster allocations stabilize or the iteration limit is reached.
What is Form Recognizer and how does it work?
mainForm Recognizer is an advanced Computer Vision service designed for semantic extraction of information from forms (such as invoices, receipts, and purchase orders).
Unlike standard Optical Character Recognition (OCR) which simply extracts raw text, Form Recognizer captures the structure of the document. It uses machine learning models to identify:
- Key/value pairs: Mapping field names to their specific values.
- Tables: Extracting structured data from rows and columns.
- Semantic relationships: Understanding the context of text (e.g., identifying which number is the 'Total' vs the 'Tax').
Interpret Score Model results
mainAfter running a pipeline containing a Score Model module, you can preview the Scored dataset to evaluate predictions.
Key Columns in Scored Dataset:
- [Label Column Name] (e.g.,
Diabetic): The actual known true values from the dataset. - Scored Labels: The predicted label values generated by the model.
- Scored Probabilities: A probability value between 0 and 1 indicating the likelihood of a positive prediction.
Decision Threshold Logic:
- Probabilities > 0.5 result in a predicted label of 1 (e.g., diabetic).
- Probabilities between 0 and 0.5 result in a predicted label of 0 (e.g., not diabetic).
- [Label Column Name] (e.g.,
Define Intents, Utterances, and Entities in CLU
mainTo build a functional model, you must define the schema using three core components:
- Intents: The specific actions the user wants to perform (e.g.,
switch_on,switch_off). - Utterances: Sample phrases that represent an intent. You should provide at least five different examples per intent to ensure sufficient training.
- Entities: Specific pieces of information within an utterance (e.g., a
devicelike 'fan' or 'light'). Entities can be defined as a List type.
Workflow:
- Schema Definition: Add intents (use lower-case names like
switch_on). - Data Labeling: Select an intent, add utterances, and then highlight specific words within those utterances to assign them to an entity (e.g., highlighting 'fan' and assigning it to the
deviceentity). - Save Changes: Always save your labeling progress to ensure the schema is updated.
- Intents: The specific actions the user wants to perform (e.g.,
Clean missing data with Clean Missing Data module
mainThe Clean Missing Data module handles null or missing values in specific columns.
- Search for Clean Missing Data in the Asset library and place it on the canvas.
- Connect the output of Select Columns in Dataset to the input of Clean Missing Data.
- Double-click the module and configure:
- Edit column -> With rules.
- Include -> Column names.
- Enter the following column names:
bore,stroke, andhorsepower. - Minimum missing value ratio:
0.0 - Maximum missing value ratio:
1.0 - Cleaning mode:
Remove entire row.
- Select Save.
Explore generative AI with Bing Copilot
mainThis lab demonstrates how to use Bing Copilot to interact with generative AI for text, image, and code generation. Bing Copilot uses natural language modeling and web information to generate original responses rather than just returning existing content.
Prerequisites
- A personal Microsoft account.
- Note: While work or school accounts work, they provide a different experience (Bing Enterprise chat) compared to the personal account experience used in this lab.
Accessing Bing Copilot
- Navigate to Bing.com.
- Sign in with your personal Microsoft account.
- Select Chat from the top menu to enter the Bing Copilot interface.
- Use the Ask me anything window at the bottom to enter prompts.
Delete a Content Safety resource to manage costs
mainTo prevent ongoing costs in your Azure subscription, delete the resource when it is no longer needed:
- Navigate to the Overview page of your Content Safety resource in the Azure Portal.
- Select Delete from the top menu.
Create an Azure AI services resource
mainTo use the Form Recognizer service, you must create either a dedicated Form Recognizer resource or a general Azure AI services resource in the Azure portal.
Configuration Steps:
- Search for Azure AI services in the Azure portal.
- Select Create.
- Configure the following settings:
- Subscription: Your active Azure subscription.
- Resource group: A unique resource group.
- Region: Any available region.
- Name: A unique resource name.
- Pricing tier:
Standard S0.
- Review and create the resource.
Once deployed, navigate to the Keys and Endpoint page of the resource. You will need the Endpoint URL and one of the Keys to authenticate client applications.
Create a tabular dataset from a web URL
mainYou can create a data asset in Azure Machine Learning studio to use in your pipelines.
- Go to the Data page under Assets and select + Create.
- Configure the following settings for a tabular dataset:
- Name:
diabetes-data - Description:
Diabetes data - Dataset type:
Tabular - Data source:
From web files - Web URL:
https://aka.ms/diabetes-data - File format:
Delimited - Delimiter:
Comma - Encoding:
UTF-8 - Column headers:
Only first file has headers
- Name:
- In the Schema section, include all columns except Path.
- Review and select Create.
Configure and run the analyze-text.ps1 client application
mainYou can test the Language service (detecting language, extracting key phrases, sentiment, and entities) using a provided PowerShell script.
1. Clone the repository
In Cloud Shell, run:
git clone https://github.com/MicrosoftLearning/AI-900-AIFundamentals ai-9002. Configure credentials
Open the script in the Cloud Shell editor:
cd ai-900 code analyze-text.ps1In the editor, locate the
YOUR_KEYandYOUR_ENDPOINTplaceholders and replace them with the values obtained from your Azure AI services resource's Keys and Endpoints page.Example configuration:
$key="1a2b3c4d5e6f7g8h9i0j...." $endpoint="https..."Save the file using the editor menu and close the editor.
3. Execute the analysis
Run the script against text files (e.g.,
review1.txt,review2.txt) using the following command:./analyze-text.ps1 <filename>.txt# Clone the repo git clone https://github.com/MicrosoftLearning/AI-900-AIFundamentals ai-900 # Navigate and run the script cd ai-900 ./analyze-text.ps1 review1.txtCreate a Conversational Language Understanding App
mainConversational Language Understanding apps are managed via the Language Studio portal (https://language.azure.com).
Setup Steps:
- Sign in to Language Studio with your Azure account.
- Link your existing Language resource to the studio.
- Navigate to Create new > Conversational language understanding.
- Configure the project:
- Name: A unique project name.
- Description: A brief description (e.g., 'Simple home automation').
- Utterances primary language: Select your target language (e.g., English).
- Enable multiple languages in project: Leave unchecked for single-language projects.