AI-900: Microsoft Azure AI Fundamentals Lab Exercises

repository·main·Indexed 18 days ago

https://github.com/microsoftlearning/ai-900-aifundamentals

Hands-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.

Tokens
20.3K
Snippets
30
Records
100
Agent score
62%

What's inside ai-900-aifundamentals

  1. What is K-Means clustering?

    main

    K-Means is a clustering algorithm that groups data observations into K number of clusters. It works by:

    1. Initializing K coordinates as randomly selected points called centroids in n-dimensional space.
    2. Plotting feature vectors as points and assigning each point to its closest centroid.
    3. Moving the centroids to the center (the mean) of the points allocated to them.
    4. Reassigning points to the new closest centroids.
    5. Repeating these steps until cluster allocations stabilize or the iteration limit is reached.
  2. What is Form Recognizer and how does it work?

    main

    Form 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').
  3. Interpret Score Model results

    main

    After 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).
  4. Define Intents, Utterances, and Entities in CLU

    main

    To 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 device like 'fan' or 'light'). Entities can be defined as a List type.

    Workflow:

    1. Schema Definition: Add intents (use lower-case names like switch_on).
    2. 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 device entity).
    3. Save Changes: Always save your labeling progress to ensure the schema is updated.
  5. Clean missing data with Clean Missing Data module

    main

    The Clean Missing Data module handles null or missing values in specific columns.

    1. Search for Clean Missing Data in the Asset library and place it on the canvas.
    2. Connect the output of Select Columns in Dataset to the input of Clean Missing Data.
    3. Double-click the module and configure:
      • Edit column -> With rules.
      • Include -> Column names.
      • Enter the following column names: bore, stroke, and horsepower.
      • Minimum missing value ratio: 0.0
      • Maximum missing value ratio: 1.0
      • Cleaning mode: Remove entire row.
    4. Select Save.
  6. Explore generative AI with Bing Copilot

    main

    This 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

    1. Navigate to Bing.com.
    2. Sign in with your personal Microsoft account.
    3. Select Chat from the top menu to enter the Bing Copilot interface.
    4. Use the Ask me anything window at the bottom to enter prompts.
  7. Create an Azure AI services resource

    main

    To 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:

    1. Search for Azure AI services in the Azure portal.
    2. Select Create.
    3. 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.
    4. 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.

  8. Create a tabular dataset from a web URL

    main

    You can create a data asset in Azure Machine Learning studio to use in your pipelines.

    1. Go to the Data page under Assets and select + Create.
    2. 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
    3. In the Schema section, include all columns except Path.
    4. Review and select Create.
  9. Configure and run the analyze-text.ps1 client application

    main

    You 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-900

    2. Configure credentials

    Open the script in the Cloud Shell editor:

    cd ai-900
    code analyze-text.ps1

    In the editor, locate the YOUR_KEY and YOUR_ENDPOINT placeholders 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.txt
  10. Create a Conversational Language Understanding App

    main

    Conversational Language Understanding apps are managed via the Language Studio portal (https://language.azure.com).

    Setup Steps:

    1. Sign in to Language Studio with your Azure account.
    2. Link your existing Language resource to the studio.
    3. Navigate to Create new > Conversational language understanding.
    4. 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.