Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

2020 04 10 Catch IT - Getting started with ML.Net

409 views

Published on

Slides used during the session "Getting started with ML.Net" with the CatchIT community on April 10, 2020.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

2020 04 10 Catch IT - Getting started with ML.Net

  1. 1. Getting started with ML.Net Bruno Capuano Innovation Lead @Avanade @elbruno | http://elbruno.com
  2. 2. Deep Neural Network: Cat vs Dog https://becominghuman.ai/building-an-image-classifier-using-deep-learning-in-python-totally-from-a-beginners-perspective-be8dbaf22dd8
  3. 3. Computer Vision
  4. 4. Why is this hard? You see this: But the camera sees this:
  5. 5. Computer Vision
  6. 6. DESKTOP CLOUDWEB MOBILE ML .NET IoTGAMING Your platform for building anything
  7. 7. Windows 10 (Windows Defender) Power Point (Design Ideas) Excel (Chart Recommendations) Bing Ads (Ad Predictions) + more Azure Stream Analytics (Anomaly Detection) Power BI (Key Influencers) ML.NET is proven at scale, enterprise ready
  8. 8. Proven & Extensible Open Source & Cross platform dot.net/ml Build your own Developer Focused ML.NET is a machine learning framework made for .NET developers
  9. 9. And many more examples @ https://github.com/dotnet/machinelearning-samples Customer segmentation Recommendations Predictive maintenance Forecasting Issue Classification Ranking news/topics Image classification Sentiment Analysis Machine Learning scenarios with ML.NET
  10. 10. Easy / Less Control Full Control / Harder Vision Speech Language Knowledge SearchLabs TextAnalyticsAPI client = new TextAnalyticsAPI(); client.AzureRegion = AzureRegions.Westus; client.SubscriptionKey = "1bf33391DeadFish"; client.Sentiment( new MultiLanguageBatchInput( new List<MultiLanguageInput>() { new MultiLanguageInput("en","0", "This is a great vacuum cleaner") })); e.g. Sentiment Analysis using Azure Cognitive Services 96% positive Pre-built machine learning models
  11. 11. Easy / Less Control Full Control / Harder TextAnalyticsAPI client = new TextAnalyticsAPI(); client.AzureRegion = AzureRegions.Westus; client.SubscriptionKey = "1bf33391DeadFish"; client.Sentiment( new MultiLanguageBatchInput( new List<MultiLanguageInput>() { new MultiLanguageInput("en","0", "This vacuum cleaner sucks so much dirt") })); e.g. Sentiment Analysis using Azure Cognitive Services 9% positive Vision Speech Language Knowledge SearchLabs Limitations with pre-built machine learning models
  12. 12. Load Data Extract Features Model Consumption Train Model Evaluate Model Prepare Your Data Build & Train Run Machine Leaning workflow
  13. 13. Machine Learning.Net Getting Started with Sentiment Analysis
  14. 14. Comment Toxic? (Sentiment) ==RUDE== Dude, you are rude … 1 == OK! == IM GOING TO VANDALIZE … 1 I also found use of the word "humanists” confusing … 0 Oooooh thank you Mr. DietLime … 0 Wikipedia detox data at https://figshare.com/articles/Wikipedia_Talk_Labels_Personal_Attacks/4054689 Features (input) Label (output) Sentiment Analysis
  15. 15. Is this A or B? Is this a toxic comment? Yes or no Sentiment analysis explained
  16. 16. Prepare Your Data Example Comment Toxic? (Sentiment) ==RUDE== Dude, you are rude … 1 == OK! == IM GOING TO VANDALIZE … 1 I also found use of the word "humanists” confusing … 0 Oooooh thank you Mr. DietLime … 0 Important concepts: Data
  17. 17. Prepare Your Data Text Featurizer Featurized Text [0.76, 0.65, 0.44, …] [0.98, 0.43, 0.54, …] [0.35, 0.73, 0.46, …] [0.39, 0, 0.75, …] Example Text ==RUDE== Dude, you are rude … == OK! == IM GOING TO VANDALIZE … I also found use of the word "humanists” … Oooooh thank you Mr. DietLime … Important concepts: Transformer
  18. 18. Build & Train Example Estimator Comment Toxic? (Sentiment) ==RUDE== Dude, you … 1 == OK! == IM GOING … 1 I also found use of the … 0 Oooooh thank you Mr. … 0 Important concepts: Estimator
  19. 19. Comment ==RUDE== Dude, you … Prediction Function Predicted Label – Toxic? (Sentiment) 1 Run Example Important concepts: Prediction Function
  20. 20. Demo: Sentiment Analysis MakeMagicHappen(); https://www.avanade.com/AI
  21. 21. Machine Learning.Net Anomaly Detection
  22. 22. Anomaly Detection Anomaly detection detects data points in data that does not fit well with the rest of the data. It has a wide range of applications such as fraud detection, surveillance, diagnosis, data cleanup, and predictive maintenance.
  23. 23. Anomaly Detection Hello World MakeMagicHappen(); https://www.avanade.com/AI
  24. 24. Load Data Extract Features Model Consumption Train Model Evaluate Model Prepare Your Data Build & Train Run Machine Leaning workflow
  25. 25. Machine Learning.Net AutoML and Model Builder
  26. 26. AutoML Model Builder ML.NET Tooling ML.NET CLI global tool accelerates productivity
  27. 27. How much is the taxi fare for 1 passenger going from Burlington to Toronto? ML.NET CLI global tool accelerates productivity AutoML with ML.NET
  28. 28. Criterion Loss Min Samples Split Min Samples Leaf XYZ Parameter 1 Parameter 2 Parameter 3 Parameter 4 … Distance Trip time Car type Passengers Time of day … Gradient Boosted Nearest Neighbors SGD Bayesian Regression LGBM … Distance Gradient Boosted Model Car type Passengers Getting started w/machine learning can be hard ML.NET takes the guess work out of data prep, feature selection & hyperparameter tuning Which algorithm? Which parameters?Which features? Getting started w/machine learning can be hard
  29. 29. N Neighbors Weights Metric P ZYX Criterion Loss Min Samples Split Min Samples Leaf XYZ Which algorithm? Which parameters?Which features? Distance Trip time Car type Passengers Time of day … Gradient Boosted Nearest Neighbors SGD Bayesian Regression LGBM … Nearest Neighbors Model Iterate Gradient BoostedDistance Car brand Year of make Car type Passengers Trip time Getting started w/machine learning can be hard ML.NET takes the guess work out of data prep, feature selection & hyperparameter tuning Getting started w/machine learning can be hard
  30. 30. Which algorithm? Which parameters?Which features? Iterate Getting started w/machine learning can be hard ML.NET takes the guess work out of data prep, feature selection & hyperparameter tuning Getting started w/machine learning can be hard
  31. 31. 25%40%70% 25% 95% 25% 25% 25% 25% 40% 40% 40% 40% 70% 70% 70%Enter data Define goals Apply constraints Input Intelligently test multiple models in parallel Optimized model 95% ML.NET accelerates model development
  32. 32. 70%95% Feature importance Distance Trip time Car type Passengers Time of day 0 1 Model B (70%) Distance 0 1 Trip time Car type Passengers Time of day Feature importance Model A (95%) ML.NET accelerates model development with model explainability ML.NET accelerates model development
  33. 33. Demo: Auto ML MakeMagicHappen(); https://www.avanade.com/AI
  34. 34. # STEP 1: Load data IDataView trainingDataView = mlContext.Data.LoadFromTextFile<TaxiTrip>( ... ) IDataView testDataView = mlContext.Data.LoadFromTextFile<TaxiTrip>( ... ) ConsoleHelper.ShowDataViewInConsole(mlContext, trainingDataView) # STEP 2: Initialize user-defined progress handler that AutoML will invoke after each model var progressHandler = new RegressionExperimentProgressHandler() # STEP 3: Run AutoML regression experiment ExperimentResult<RegressionMetrics> experimentResult = mlContext.Auto() .CreateRegressionExperiment(ExperimentTime) .Execute(trainingDataView, LabelColumnName, progressHandler: progressHandler) PrintTopModels(experimentResult) # STEP 4: Evaluate the model on test data RunDetail<RegressionMetrics> best = experimentResult.BestRun ITransformer trainedModel = best.Model IDataView predictions = trainedModel.Transform(testDataView) # STEP 5: Save trained model to a .ZIP file mlContext.Model.Save(trainedModel, trainingDataView.Schema, ModelPath)
  35. 35. Demo: Auto ML MakeMagicHappen(); https://www.avanade.com/AI
  36. 36. Try ML.NET today! http://dot.net/ml http://aka.ms/mlnetsamples http://aka.ms/mlnetdocs http://aka.ms/mlnet https://aka.ms/mlnetprod
  37. 37. Getting started with ML.Net Bruno Capuano Innovation Lead @Avanade @elbruno | http://elbruno.com

×