or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

asset-management.mdautoml.mdclient-auth.mdcompute-management.mdhyperparameter-tuning.mdindex.mdjob-management.mdmodel-deployment.md
tile.json

tessl/pypi-azure-ai-ml

Microsoft Azure Machine Learning Client Library for Python providing comprehensive SDK for ML workflows including job execution, pipeline components, model deployment, and AutoML capabilities

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-ai-ml@1.28.x

To install, run

npx @tessl/cli install tessl/pypi-azure-ai-ml@1.28.0

index.mddocs/

Azure AI ML

Microsoft Azure Machine Learning Client Library for Python providing comprehensive SDK for ML workflows including job execution, pipeline components, model deployment, and AutoML capabilities. The SDK v2 introduces a unified object model that ensures consistency across different ML operations, supports local and cloud-based execution, provides built-in telemetry and monitoring, and integrates seamlessly with Azure Identity for authentication.

Package Information

  • Package Name: azure-ai-ml
  • Language: Python
  • Installation: pip install azure-ai-ml

Core Imports

from azure.ai.ml import MLClient

Common imports for working with Azure ML:

from azure.ai.ml import MLClient, command, spark, Input, Output
from azure.ai.ml import (
    MpiDistribution,
    PyTorchDistribution, 
    TensorFlowDistribution,
    RayDistribution
)
from azure.ai.ml.entities import (
    CommandJob,
    SparkJob,
    Model,
    Environment,
    Data,
    Component,
    Workspace,
    BatchEndpoint,
    OnlineEndpoint
)

Basic Usage

from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential

# Create ML client
ml_client = MLClient(
    credential=DefaultAzureCredential(),
    subscription_id="your-subscription-id",
    resource_group_name="your-resource-group",
    workspace_name="your-workspace"
)

# Submit a simple command job
from azure.ai.ml import command
from azure.ai.ml.entities import Environment

job = command(
    code="./src",
    command="python train.py --learning_rate ${{inputs.learning_rate}}",
    inputs={"learning_rate": 0.01},
    environment=Environment(
        image="mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04:latest"
    ),
    compute="cpu-cluster"
)

submitted_job = ml_client.jobs.create_or_update(job)
print(f"Job submitted: {submitted_job.name}")

Architecture

The Azure AI ML SDK is built around a unified object model with several key components:

  • MLClient: Central client for all Azure ML operations, organizing functionality into operation groups
  • Entities: Data classes representing Azure ML resources (jobs, models, endpoints, compute, etc.)
  • Operations: Classes containing logic to interact with backend services for different resource types
  • Builders: Functions like command(), spark() for creating job configurations
  • Assets: Reusable resources like data, models, environments, and components
  • AutoML: Automated machine learning capabilities for tabular, image, and NLP tasks

The SDK supports both imperative programming through direct API calls and declarative approaches through YAML-based configurations, enabling flexible workflows for different use cases.

Capabilities

Client and Authentication

Main client class for Azure Machine Learning operations with authentication and workspace management capabilities.

class MLClient:
    def __init__(
        self,
        credential,
        subscription_id: str = None,
        resource_group_name: str = None,
        workspace_name: str = None,
        **kwargs
    ): ...

Client and Authentication

Job Management

Comprehensive job execution capabilities including command jobs, pipeline jobs, Spark jobs, sweep jobs for hyperparameter tuning, and AutoML jobs for automated machine learning.

def command(
    *,
    code: str = None,
    command: str,
    inputs: dict = None,
    outputs: dict = None,
    environment: Environment = None,
    compute: str = None,
    **kwargs
) -> CommandJob: ...

def spark(
    *,
    code: str,
    entry: SparkJobEntry,
    compute: str,
    inputs: dict = None,
    outputs: dict = None,
    **kwargs
) -> SparkJob: ...

class CommandJob:
    def __init__(
        self,
        *,
        command: str,
        code: str = None,
        inputs: dict = None,
        outputs: dict = None,
        environment: Environment = None,
        compute: str = None,
        **kwargs
    ): ...

Job Management

Model Deployment

Online and batch deployment capabilities for model inference with comprehensive endpoint and deployment management.

class OnlineEndpoint:
    def __init__(
        self,
        *,
        name: str,
        auth_mode: str = "key",
        description: str = None,
        tags: dict = None,
        **kwargs
    ): ...

class ManagedOnlineDeployment:
    def __init__(
        self,
        *,
        name: str,
        endpoint_name: str,
        model: Model,
        environment: Environment = None,
        code_configuration: CodeConfiguration = None,
        instance_type: str = "Standard_DS3_v2",
        instance_count: int = 1,
        **kwargs
    ): ...

Model Deployment

Asset Management

Comprehensive asset management for models, data, environments, and components with versioning and lineage tracking.

class Model:
    def __init__(
        self,
        *,
        name: str,
        path: str = None,
        version: str = None,
        description: str = None,
        tags: dict = None,
        **kwargs
    ): ...

class Data:
    def __init__(
        self,
        *,
        name: str,
        path: str = None,
        version: str = None,
        type: str = "uri_folder",
        description: str = None,
        **kwargs
    ): ...

Asset Management

Compute Management

Compute resource management including Azure ML compute clusters, compute instances, and attached compute resources.

class AmlCompute:
    def __init__(
        self,
        *,
        name: str,
        type: str = "amlcompute",
        size: str,
        min_instances: int = 0,
        max_instances: int = 1,
        idle_time_before_scale_down: int = 1800,
        **kwargs
    ): ...

class ComputeInstance:
    def __init__(
        self,
        *,
        name: str,
        size: str,
        **kwargs
    ): ...

Compute Management

AutoML

Automated machine learning capabilities for tabular data (classification, regression, forecasting), computer vision tasks (image classification, object detection), and natural language processing.

def classification(
    *,
    target_column_name: str,
    training_data: Data,
    validation_data: Data = None,
    test_data: Data = None,
    primary_metric: str = "accuracy",
    **kwargs
) -> ClassificationJob: ...

def regression(
    *,
    target_column_name: str,
    training_data: Data,
    validation_data: Data = None,
    test_data: Data = None,
    primary_metric: str = "normalized_root_mean_squared_error",
    **kwargs
) -> RegressionJob: ...

def forecasting(
    *,
    target_column_name: str,
    time_column_name: str,
    training_data: Data,
    validation_data: Data = None,
    test_data: Data = None,
    primary_metric: str = "normalized_root_mean_squared_error",
    **kwargs
) -> ForecastingJob: ...

def image_classification(
    *,
    target_column_name: str,
    training_data: Data,
    validation_data: Data = None,
    primary_metric: str = "accuracy",
    **kwargs
) -> ImageClassificationJob: ...

def text_classification(
    *,
    target_column_name: str,
    training_data: Data,
    validation_data: Data = None,
    primary_metric: str = "accuracy",
    **kwargs
) -> TextClassificationJob: ...

AutoML

Hyperparameter Tuning

Advanced hyperparameter optimization with various search spaces, sampling algorithms, and early termination policies.

class Choice:
    def __init__(self, values: list): ...

class Uniform:
    def __init__(self, min_value: float, max_value: float): ...

class SweepJob:
    def __init__(
        self,
        *,
        trial: CommandJob,
        search_space: dict,
        objective: Objective,
        sampling_algorithm: SamplingAlgorithm = None,
        **kwargs
    ): ...

Hyperparameter Tuning

Workspace and Registry Management

Workspace operations, registry management, and workspace connections for external services.

class Workspace:
    def __init__(
        self,
        *,
        name: str,
        description: str = None,
        tags: dict = None,
        location: str = None,
        **kwargs
    ): ...

class Registry:
    def __init__(
        self,
        *,
        name: str,
        location: str,
        **kwargs
    ): ...

Note: Workspace management, pipelines/components, data management, feature store, and monitoring capabilities are also available through the MLClient operation groups. Refer to the API reference notes for complete details.

Types

class Input:
    def __init__(
        self,
        *,
        type: str,
        path: str = None,
        mode: str = None,
        **kwargs
    ): ...

class Output:
    def __init__(
        self,
        *,
        type: str,
        path: str = None,
        mode: str = None,
        **kwargs
    ): ...

class SystemData:
    created_at: str
    created_by: str
    created_by_type: str
    last_modified_at: str
    last_modified_by: str
    last_modified_by_type: str