Skip to content

Instantly share code, notes, and snippets.

Avatar
😊

Clemens Siebler csiebler

😊
View GitHub Profile
@csiebler
csiebler / private_repo.md
Last active Nov 16, 2020
Adding private Azure DevOps Artifact feeds to Azure Machine Learning
View private_repo.md

Steps:

  • Create private Feed in Azure DevOps
  • Create Personal Access Token (PAT) in Azure DevOps with Feed Read permission (details)
  • Navigate to the Azure DevOps Artifacts Feed page where you can see the details for the next steps (you'll need feed name, project name, organization name and later also package name): feed terminology
  • Create Build pipeline in Azure DevOps to create package and push to private feed:
trigger:
@csiebler
csiebler / hyperparameters.py
Created Oct 14, 2020
Get metrics and hyperparameters for each run in HyperDriveStepRun in Azure Machine Learning
View hyperparameters.py
# Get the HyperDriveStep of the pipeline by name (make sure only 1 exists)
hd_step_run = HyperDriveStepRun(step_run=pipeline_run.find_step_run('hd_step01')[0])
# Get RunID for best run (we're lazy)
best_run_id = hd_step_run.get_best_run_by_primary_metric().id
# Get all hyperparameters that where tried
hyperparameters = hd_step_run.get_hyperparameters()
# Get all metrics for the runs
@csiebler
csiebler / mount_dataset.py
Last active Oct 1, 2020
Mount Dataset to Azure Machine Learning Compute Instance
View mount_dataset.py
import os
import pandas as pd
from azureml.core import Workspace, Dataset
# Connect to Workspace and reference Dataset
ws = Workspace.from_config()
dataset = ws.datasets["german-credit-train-tutorial"]
# Create mountcontext and mount the dataset
mount_ctx = dataset.mount()
@csiebler
csiebler / example.md
Created May 15, 2020
Get run_id of training run in Azure Machine Learning Pipeline Step
View example.md

In train.py:

run.tag('run_type', value='training')

In later step:

#Retrieve associated run, workspace and experiment
run = Run.get_context()
@csiebler
csiebler / example.md
Created May 15, 2020
Get run_id of training run in Azure Machine Learning Pipeline Step
View example.md

In train.py:

run.tag('run_type', value='training')

In later step:

#Retrieve associated run, workspace and experiment
run = Run.get_context()
@csiebler
csiebler / predict.py
Created May 5, 2020
Prediction script example
View predict.py
import json
import os
import numpy as np
import pandas as pd
import joblib
# Your imports go here
# Update to your model's filename
model_filename = "model.pkl"
@csiebler
csiebler / train.py
Created May 5, 2020
A short example for train.py
View train.py
import os
import sys
import argparse
import joblib
import pandas as pd
from azureml.core import Run
from azureml.core.run import Run
from sklearn.compose import ColumnTransformer
@csiebler
csiebler / deploy.sh
Created Aug 8, 2019
Deploy to Function App
View deploy.sh
cd python-functions
func azure functionapp publish functions-python-test --python --build-native-deps
@csiebler
csiebler / install.sh
Created Aug 8, 2019
Install Function Runtime
View install.sh
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update
sudo apt-get install azure-functions-core-tools
@csiebler
csiebler / host.json
Created Aug 6, 2019
Functions Host Definition
View host.json
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
}
}
You can’t perform that action at this time.