This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#connect cluster('help').database('Samples') | |
// https://aka.ms/adx.iot > assets > demos > ML slides | |
// explore, dont see metrics | |
demo_make_series1 | take 10 | |
// make timeseries | |
let min_t = toscalar(demo_make_series1 | summarize min(TimeStamp)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// #connect cluster('igniteadxsource.eastus2').database('Occupancy') | |
#connect cluster('adxpm10774.eastus').database('IoTAnalytics') | |
print("😍 ML 🤖") | |
// Python UnSupervised Learning | |
//Create a cusotm UDF to run K-Means clustering using Python plugin | |
.create-or-alter function with (folder = "Python") kmeans_sf_OccupDetc(tbl:(*),k:int,features:dynamic,cluster_col:string) { | |
let kwargs = pack('k', k, 'features', features, 'cluster_col', cluster_col); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#connect cluster('adxpm10774.eastus').database('IoTAnalytics') | |
//Data lands in the StageIoTRaw table so lets look at that first | |
.show table StageIoTRawData | |
StageIoTRawData //retention 1-2 days, or 0 to delete it. Good to keep short period of time to troubleshoot. | |
| count //2168352 | |
StageIoTRawData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#connect cluster('kvc43f0ee6600e24ef2b0e.southcentralus').database('MyDatabase') | |
// ref https://docs.microsoft.com/azure/data-explorer/ingest-data-one-click | |
// ref https://docs.microsoft.com/azure/data-explorer/ingest-sample-data?tabs=one-click-ingest | |
// ref https://docs.microsoft.com/azure/data-explorer/kusto/management/data-ingestion/ingest-from-storage | |
// public sample, no SAS key required. | |
.ingest into table StormEvents ( | |
h'https://kustosamples.blob.core.windows.net/samplefiles/StormEvents.csv' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#connect cluster('kvc43f0ee6600e24ef2b0e.southcentralus').database('MyDatabase') | |
// https://aka.ms/adx.free | |
// iot document, multiple devices, multi-line json | |
// see oreProperties | |
.drop table iotPayload ifexists | |
.set iotPayload <| | |
let d= dynamic( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// El Puente | |
// grab primes | |
https://kustodetectiveagency.blob.core.windows.net/prime-numbers/prime-numbers.csv.gz | |
// Create table command | |
//////////////////////////////////////////////////////////// | |
.create table ['primes'] (['num']:long) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#connect cluster('kvc43f0ee6600e24ef2b0e.southcentralus').database('KustoDetectiveAgency') | |
// Commander | |
// We have a situation, rookie. | |
// As you may have heard from the news, there was a bank robbery earlier today. | |
// In short: the good old downtown bank located at 157th Ave / 148th Street has been robbed. | |
// The police were too late to arrive and missed the gang, and now they have turned to us to help locating the gang. | |
// No doubt the service we provided to the mayor Mrs. Gaia Budskott in past - helped landing this case on our table now. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rarest book gone missing! | |
.drop table Books ifexists | |
.drop table Shelves ifexists | |
.execute database script <| | |
// Create table for the books | |
.create table Books(rf_id:string, book_title:string, publish_date:long, author:string, language:string, number_of_pages:long, weight_gram:long) | |
// Import data for books |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////// | |
// The Lieutenant // | |
//////////////////// | |
// create free cluster and db at https://aka.ms/free | |
// sum values in the Score column | |
.drop table Onboarding ifexists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let k = dynamic({"type":"polygon","coordinates":[ | |
[ | |
[ | |
-78.90380859375, | |
30.12612436422458 | |
], | |
[ | |
-78.81591796875, | |
25.661333498952683 | |
], |