Skip to content

Instantly share code, notes, and snippets.

View csiebler's full-sized avatar
😊

Clemens Siebler csiebler

😊
View GitHub Profile
@csiebler
csiebler / anomalydetection.py
Last active April 1, 2019 14:58
Anomaly Detection Python Example
import requests
import json
import pandas as pd
import matplotlib.pyplot as plt
subscription_key = "xxxxxxx"
endpoint = "https://westeurope.api.cognitive.microsoft.com"
batch_detection_url = "/anomalydetector/v1.0/timeseries/entire/detect"
latest_point_detection_url = "/anomalydetector/v1.0/timeseries/last/detect"
@csiebler
csiebler / TestController.cs
Created May 7, 2019 06:35
Provisioning Azure resources using Managed Identity (w/local fallback) and Azure Fluent SDK
System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Management.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent.Authentication;
using Microsoft.Azure.Services.AppAuthentication;
using Microsoft.Rest;
@csiebler
csiebler / __init__.py
Created June 14, 2019 07:46
Dummy Python Function
import logging
import json
import azure.functions as func
def main(req: func.HttpRequest) -> func.HttpResponse:
products = [
{
"name": "Azure DevOps",
"price": 4.99
@csiebler
csiebler / host.json
Created August 6, 2019 17:46
Functions Host Definition
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
}
}
@csiebler
csiebler / install.sh
Created August 8, 2019 15:25
Install Function Runtime
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 / deploy.sh
Created August 8, 2019 15:31
Deploy to Function App
cd python-functions
func azure functionapp publish functions-python-test --python --build-native-deps
@csiebler
csiebler / train.py
Created May 5, 2020 09:35
A short example for 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 / predict.py
Created May 5, 2020 09:39
Prediction script example
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 / example.md
Created May 15, 2020 11:39
Get run_id of training run in Azure Machine Learning Pipeline Step

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 11:39
Get run_id of training run in Azure Machine Learning Pipeline Step

In train.py:

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

In later step:

#Retrieve associated run, workspace and experiment
run = Run.get_context()