Skip to content

Instantly share code, notes, and snippets.

View lucazav's full-sized avatar
💭
Earning the Udacity Azure Machine Learning Engineer Nanodegree certification

Luca Zavarella lucazav

💭
Earning the Udacity Azure Machine Learning Engineer Nanodegree certification
View GitHub Profile
@lucazav
lucazav / azureml-create-pipeline.yml
Created April 18, 2025 13:56
[AzureML - Pipelines] Manage Pipelines #azureml #azurecli
$schema: https://azuremlschemas.azureedge.net/latest/pipelineJob.schema.json
type: pipeline
experiment_name: aml_pipeline_cli
compute: azureml:cluster-cpu
inputs:
data_dir:
path: azureml:data-fashion-mnist@latest
type: uri_folder
@lucazav
lucazav / azure-create-component.yml
Last active April 18, 2025 14:37
[AzureML - Components] Manage Components #azureml #azurecli
$schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json
name: component_pipeline_cli_train
version: 3
type: command
inputs:
data_dir:
type: uri_folder
outputs:
@lucazav
lucazav / azureml-create-online-endpoint-deployment.yml
Last active April 23, 2025 14:19
[AzureML - Endpoints] Manage Online Endpoints and Deployments #azureml #azurecli
# Schema Reference: https://learn.microsoft.com/en-us/azure/machine-learning/reference-yaml-deployment-managed-online?view=azureml-api-2
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineDeployment.schema.json
name: blue
endpoint_name: endpoint-command-cli
model: azureml:model-command-cli@latest
instance_type: Standard_DS3_v2
instance_count: 1
@lucazav
lucazav / azureml-create-command-job-inline-env.sh
Last active April 18, 2025 14:52
[AzureML - Jobs] Manage Training Command Jobs and Registering Models #azureml #azurecli
# Standard command.
az ml job create -f cloud/azureml-create-command-job-inline-env.yml
# Once the job finishes training the model, if we want to register the model for example, that requires a reference to the job instance. In that case:
run_id=$(az ml job create -f cloud/azureml-create-command-job-inline-env.yml --query name -o tsv)
# az ml job reference: https://learn.microsoft.com/en-us/cli/azure/ml/job?view=azure-cli-latest#az-ml-job-create
# Register the model using the run_id:
az ml model create --name model-command-cli --path "azureml://jobs/$run_id/outputs/model" --type mlflow_model
@lucazav
lucazav / azureml-manage-data-assets.sh
Last active April 15, 2025 13:55
[AzureML - Data] Manage Data Assets #azureml #azurecli
# Upload data from local folder (or remote path)
az ml data create -f cloud/azureml-upload-local-folder.yml
@lucazav
lucazav / azureml-create-compute-cluster.yml
Last active April 15, 2025 13:53
[AzureML - Setup] Manage Compute Cluster #azurecli #azureml
$schema: https://azuremlschemas.azureedge.net/latest/amlCompute.schema.json
type: amlcompute
name: cluster-cpu
size: STANDARD_DS3_v2
min_instances: 0
max_instances: 2
idle_time_before_scale_down: 600
@lucazav
lucazav / azurecli-login.sh
Last active February 9, 2026 13:24
[Azure] Sign Into Azure with Azure CLI #azurecli
# Check if you're already logged in
az account show
# Interactive login
az login
# Interactive login with device code
az login --use-device-code
# Sign in with a system-assigned managed identity
@lucazav
lucazav / aml-install-azurecli-ml-locally.txt
Last active April 23, 2025 12:05
[AzureML - Setup] Install Azure CLI for Machine Learning #azureml #azurecli
To install Azure CLI and its ML extension on your local machine, follow these links:
- Install the Azure CLI by following the instructions in the documentation (https://docs.microsoft.com/en-us/cli/azure/install-azure-cli).
- Install the ML extension to the Azure CLI by following the "Installation" section of the documentation (https://docs.microsoft.com/en-us/azure/machine-learning/how-to-configure-cli).
CLI (v2) core YAML syntax:
https://learn.microsoft.com/en-us/azure/machine-learning/reference-yaml-core-syntax?view=azureml-api-2
@lucazav
lucazav / fish_market_demo.py
Last active February 16, 2025 13:28
This script demonstrates how to use the `find_best_split_seed` function from the `find_robust_seed` package to identify the most stable random seed for train-test splits. The goal is to ensure that the training and test datasets maintain the statistical properties of the original dataset.
# %%
"""
This script demonstrates how to use the `find_best_split_seed` function from the `find_robust_seed` package
implemented in the https://github.com/lucazav/Robust-Multi-Objective-Optimization-for-Train-Test-Splits repository
to identify the most stable random seed for train-test splits. The goal is to ensure that the training
and test datasets maintain the statistical properties of the original dataset.
Key Features:
- Loads and cleans a dataset (Fish Market) using PyJanitor for column name normalization.
- Uses `find_best_split_seed` to evaluate multiple random seeds and find the most robust split.
@lucazav
lucazav / conda_env_v_1_0_0.yml
Last active March 5, 2022 10:14
Example of conda environment specification file generated by Azure AutoML after training a machine learning model
# Conda environment specification. The dependencies defined in this file will
# be automatically provisioned for runs with userManagedDependencies=False.
# Details about the Conda environment file format:
# https://conda.io/docs/user-guide/tasks/manage-environments.html#create-env-file-manually
name: azureml_scoring_env
dependencies:
# The python interpreter version.
# Currently Azure ML only supports 3.5.2 and later.