Developing Intelligent Apps

Similar documents
Data Science and Machine Learning Essentials

Applied Machine Learning

Introduction to Azure Machine Learning

Data Science Essentials

Data Science and Machine Learning Essentials

Data Science and Machine Learning Essentials

Data Science and Machine Learning Essentials

SQL Server 2005: Reporting Services

Tips and Tricks for Photos

Contents. Launching Word

Nauticom NetEditor: A How-to Guide

As a reference, please find a version of the Machine Learning Process described in the diagram below.

Hosting RESTful APIs. Key Terms:

Introduction to Data Science

Roxen Content Provider

Processing Big Data with Hadoop in Azure HDInsight

Lab Android Development Environment

Data Science and Machine Learning Essentials

Part I: Creating a Simple Text Entry on a Web Page

Excel Select a template category in the Office.com Templates section. 5. Click the Download button.

Outlook 2003 Desktop Configuration for Remote Access User Guide

Step 1 Turn on the device and log in with the password, PIN, or other passcode, if necessary.

SharePoint: Fundamentals

Placing Spaces. Let Me Try! Before you begin. The following files are needed for this Let Me Try exercise: M_c04_archi_spaces_rmp2015.

FLIR Tools+ and Report Studio

SharePoint: Fundamentals

BEAWebLogic. Portal. Tutorials Getting Started with WebLogic Portal

Engr 123 Spring 2018 Notes on Visual Studio

Designing SQL Server 2012 Analysis Services Cubes using Samsclub_Star Dataset

2. create the workbook file

CA Service Virtualization Test Drive

Use signatures in Outlook 2010

Procedure to Create Custom Report to Report on F5 Virtual Services

Acrobat 6.0 Standard - Basic Tasks

Azure Application Deployment and Management: Service Fabric Create and Manage a Local and Azure hosted Service Fabric Cluster and Application

[ Getting Started with Analyzer, Interactive Reports, and Dashboards ] ]

Rich Text Editor Quick Reference

County of Sacramento Instructions for filling out an online Tree Permit

Word Getting Started The Word Window u vw. Microsoft QUICK Source. Creating a New Blank Document. Creating a New Document from a Template

Word Select New in the left pane. 3. Select Blank document in the Available Templates pane. 4. Click the Create button.

Using the JSON Iterator

Livelink Training Manual

Tutorials. Lesson 3 Work with Text

POS Designer Utility

My Awesome Presentation Exercise

In this lab, you will build and execute a simple message flow. A message flow is like a program but is developed using a visual paradigm.

Azure Developer Immersions Application Insights

Dreamweaver CS6. Table of Contents. Setting up a site in Dreamweaver! 2. Templates! 3. Using a Template! 3. Save the template! 4. Views!

Windows 2000 Safe Mode

Using Microsoft Word. Text Editing

2 The Stata user interface

Navigate to Cognos Cognos Analytics supports all browsers with the exception of Microsoft Edge.

IBM WebSphere Java Batch Lab

A Guide to Quark Author Web Edition 2015

MICROSOFT OFFICE. Courseware: Exam: Sample Only EXCEL 2016 CORE. Certification Guide

HOL159 Integrating Microsoft Technologies to Microsoft Dynamics AX 4.0. Hands-On Lab

Principles of Machine Learning

MARK5 Whiteboard guide

GoLive will first ask you if your new site will be for one individual or a work group; select for a Single User, and click Next.

with TestComplete 12 Desktop, Web, and Mobile Testing Tutorials

2 Getting Started. Getting Started (v1.8.6) 3/5/2007

Using Dreamweaver. 4 Creating a Template. Logo. Page Heading. Home About Us Gallery Ordering Contact Us Links. Page content in this area

From the dashboard, hover over the + New button, then select Pattern from the drop-down menu.

Introduction. Key features and lab exercises to familiarize new users to the Visual environment

Designing a Web Page Using MS SharePoint Designer Reference Manual

Kendo UI. Builder by Progress : Using Kendo UI Designer

Bringing Together One ASP.NET

ADOBE DREAMWEAVER CS4 BASICS

COMSC-031 Web Site Development- Part 2. Part-Time Instructor: Joenil Mistal

This walkthrough assumes you have completed the Getting Started walkthrough and the first lift and shift walkthrough.

1. Math symbols Operation Symbol Example Order

A Quick Tour GETTING STARTED WHAT S IN THIS CHAPTER?

IBM / ST SensorTile Watson IoT Workshop

1. Below is an example 1D river reach model built in HEC-RAS and displayed in the HEC-RAS user interface:

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2010

CNS Barcode. Version 1.3. Integrating with FileMaker Go

Content Publisher User Guide

PowerScheduler Course Tally Worksheet instructions.

Barchard Introduction to SPSS Marks

LAB 5 ANSWER KEY WORKING WITH FIREWALLS, ENCRYPTED FILE SYSTEMS (EFS) AND USER ACCOUNT CONTROL (UAC)

Dreamweaver MX The Basics

AHC SharePoint 2010 Intro to Content Administration

AutoCAD 2009 User InterfaceChapter1:

Chapter11 practice file folder. For more information, see Download the practice files in this book s Introduction.

Data Science and Machine Learning Essentials

XPS1 Automated Multi-Sample Run Procedure

Quark XML Author for FileNet 2.8 with BusDocs Guide

Week 5 Creating a Calendar. About Tables. Making a Calendar From a Table Template. Week 5 Word 2010

Lab 2. Task 1 : Learning basic tasks with PowerPoint. Estimated time

Lesson 1: Creating and formatting an Answers analysis

Telerik Corp. Test Studio Standalone & Visual Studio Plug-In Quick-Start Guide

Quark XML Author for FileNet 2.5 with BusDocs Guide

Parish . User Manual

The CAP Panel Builder technology is designed to construct and manage configurations of stack panel products.

Microsoft Word. An alternative to following these steps are to double click on the Microsoft Word Icon on the desktop.

Introduction to IBM Data Studio, Part 1: Get started with IBM Data Studio, Version and Eclipse

Introduction to IBM Data Studio, Part 1: Get started with IBM Data Studio, Version and Eclipse

Administration. Training Guide. Infinite Visions Enterprise Edition phone toll free fax

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2003

Lab 3-1 Lab Installing Kofax Capture 10

Transcription:

Developing Intelligent Apps Lab 1 Creating a Simple Client Application By Gerry O'Brien Overview In this lab you will construct a simple client application that will call an Azure ML web service that you will create. The Azure ML Web service you will create is based on a dataset that you will import into Azure ML Studio and is designed to perform an energy efficiency regression experiment. What You ll Need To complete this lab, you will need the following: An Azure ML account A web browser and Internet connection Microsoft Visual Studio Create the Sample Experiment In this exercise you will import a data set into Azure ML Studio and use that to create an experiment that will be used to publish as a web service. Subsequent lab steps will make use of this experiment. The experiment we create will not be complex and is only used to illustrate how to create and consume a web service. 1. Download the Building Data.csv file from the course GitHub repository at https://github.com/microsoftlearning/buildingintelligentapplications. 2. If you have not already done so, open a browser and browse to https://studio.azureml.net. Then sign in using the Microsoft account associated with your Azure ML account. 3. Click the Datasets icon on the left nav bar of Azure ML Studio. 4. Click the New button in the lower left corner to upload the dataset. 5. Choose DataSet, then From Local File. 6. Click Browse and locate the file you just downloaded and select it. 7. Click the Check Mark in the lower right corner to upload the dataset. 8. Verify that Building Data.csv is listed as a dataset. 9. Click the Experiments icon in Azure ML Studio. 10. Click New to create a new experiment and select Blank Experiment.

11. Expand the Datasets folders and locate Building Data.csv. (NOTE) The Azure interfaces are updated on a regular basis so this step may require you to locate the datasets in a folder hierarchy not in place at the time of this writing. 12. Drag and drop this dataset onto the designer surface. 13. Expand the Data Transformation category and then Sample and Split subcategory. 14. Drag a Split Data operation onto the designer surface. 15. Set the Fraction of rows in the first output dataset to 0.7 to split the data at 70/30. 16. Connect the dataset to the Split Data operation by dragging the dataset handle to the Split Data operation. 17. Expand the Machine Learning category, then Initialize Model, and finally Regression. 18. Locate the Decision Forest Regression entry and drag it onto the designer surface. 19. Expand the Score subcategory and locate the Score Model entry. 20. Drag the Score Model operation onto the designer. 21. Expand Train and drag a Train Model operation onto the designer. 22. Expand the Evaluate subcategory and drag an Evaluate Model operation onto the designer.

23. Your experiment window should now look like this: 24. Connect output 1 of the Split Data operation to the Train Model operation. 25. Select the Train Model operation. 26. Click the Launch Column Selector in the right pane of ML Studio. 27. Click the With Rules entry and then click inside the empty column list and select the Wall Area column name. 28. Click the check mark to accept the selection. 29. Connect the Decision Forest Regression operation to the remaining input of the Train Model operation. 30. Connect the second output of the Split Data operation to the Score Model operation. 31. Connect the output of the Score Model operation to the left input of the Evaluate Model operation. 32. Connect the output of the Train Model operation to the remaining Score Model input.

33. Your experiment should now look like this. 34. Run the experiment by clicking the Run button on the bottom of the designer window. 35. Ensure that you have green check marks in all the operation boxes and that the upper right corner of the designer displays Finished Running with a green check mark. 36. Save your experiment as Energy Efficiency Regression Prepare and Deploy the Web Service In this exercise you will prepare and publish your experiment as a web service, and then consume the web service from a client application. Prepare the Web Service You should have already completed the previous exercise to ensure that we have an experiment to use for publishing a web service.

1. If you have not already done so, open a browser and browse to https://studio.azureml.net. Then sign in using the Microsoft account associated with your Azure ML account. 2. Click the Experiments icon on the left nav bar of Azure ML Studio. 3. Locate your completed Energy Efficiency Regression experiment. 4. Click the experiment to open it in Azure ML Studio. 5. Depending on the state of the web service, you may not have to run it again. If it indicates Finished running in the upper right corner of the designer and you have green checks in the different stages, you are ready for the next step. If not, then click the Run button. Set Up the Web Service 1. With the Energy Efficiency Regression experiment open in the designer and displaying green check marks showing completion, hover your mouse over the Set Up Web Service button in the button bar at the bottom of the designer. 2. Select Predictive Web Service [Recommended]. 3. Verify that a new tab opens called Predictive experiment with the predictive experiment visible on this new tab. You should see a Web service input and Web service output operation on the designer. 4. Before we can deploy this web service, we need to run this new experiment. Click the Run button. 5. Verify successful completion by checking for a green check mark in the Score Model operation and Finished running in the upper right corner. 6. You are now ready for the next exercise. Deploy the Web service 1. Click the Deploy Web Service button. 2. Azure ML Studio begins the creation of web service and opens the following screen indicating success. The API key has been removed from this image but you will have an API key present in your web service.

Test the Web Service Now that the web service is deployed, let s test if first before we begin creation of the client application. 1. Click the Test button to open the data entry dialog. 2. Enter the following values in the data entry dialog (these values are taken from the training model data) 296 for wall area 110.25 for roof area 7 for overall height 0 for glazing area 15.55 for heating load 3. Click the check mark in the bottom right corner of the data entry dialog. 4. Look at the status bar for the output. You can also click the Details button to see an example of the returned JSON. Viewing the Sample Code Before you create the client application, investigate the sample request and response headers and sample code that is provided by Azure ML Studio. View the Request and Response Headers 1. Click the Request/Response link under API Help Page for the Default Endpoint 2. Azure ML Studio opens another browser tab or window with the API documentation for this web service.

3. Scroll down and view the Request Headers and Request Body to get an idea of how the request will be formed. This request is what will be sent to the web service for evaluation and is in JSON format. 4. Scroll down further and evaluate the Response Headers and Response Body sample. This shows the format of data that will be returned in the response as well as a sample of the JSON that will be returned. You can use this sample to understand how to parse the JSON for the data you want to use in your application. 5. Scrolling down further presents information about the input and output parameters which includes the names and data types expected. If you will be creating a class to represent the returned information, you can use these parameters to create the proper data types for your member variables. Create a Simple Client Application In this exercise, you will create a sample client application using either C# or Python, Visual Studio and the sample code that is provided on the web service API documentation page for your published web service. If you want to test this using R, paste the sample code into your R environment ensuring you replace the API Key and values. Evaluate the Sample Code The sample code is what you will use for the client application created in this lab. Reviewing the code first, will help you understand where to place it in our client application and how it works to create the request and consume the response. 1. Scroll all the way to the bottom of the web service API documentation window. Note the Sample Code entry contains samples in C#, Python, and R. 2. Select the tab of the language you are most familiar with and scroll through the code to see what it is doing. 3. Note the location where the API key will need to be replaced. The value abc123 is used as a placeholder and you will paste your API key in this location when creating your client application. Create a C# Console Client Application The steps in this section assume you are using Visual Studio 2015. If you are not using Visual Studio or you are using a different version, you will need to make adjustments to some of the steps as necessary to accommodate your environment. 1. Start Visual Studio if it is not already open. 2. Click New Project or select File, New, Project. 3. Expand Templates if it is not already expanded. 4. Choose Visual C# 5. Select Console Application in the middle pane. 6. In the Name: text box, give your application a name that makes sense such as AzureMLWebServiceTest.

7. Click OK to create the application and project. 8. Visual Studio creates an application stub for you containing a Program.cs class with stub code including a Main method. You will replace this code with the sample code from the web service API documentation page. 9. Switch back to your browser and locate the C# sample source code. 10. Click the Select sample code button then copy the selected code to the clipboard 11. Switch back to Visual Studio. 12. Highlight the entire code listing in Program.cs and delete it. 13. Paste the sample code into the code editor window. 14. Scroll to the top of the code file in Program.cs. 15. Note the red squiggly line under Formatting in the using System.Net.Http.Formatting entry. This means that we are missing a library that implements the functionality necessary for this using statement. 16. Locate the last comment line in the comments at the top of the code file (// Install-Package Microsoft.AspNet.WebApi.Client). 17. Copy the command without the two back slashes (//)

18. Click the Tools menu and then move your mouse over the Nuget Package Manager, and finally select Package Manager Console. 19. The Package Manager console opens at the bottom of the Visual Studio IDE. 20. Paste the command you copied into this console window and press Enter. 21. You should see a successfully installed message in the console. If so, you can close the package manager console by clicking the small x in the right corner of the console window. 22. Verify there are no more errors in the code. 23. In order for your application to access the web service, you need to paste the API key into your source code. Go back the Web service window in Azure ML Studio where you ran the first test by clicking the Test button. 24. Copy the API key. (NOTE: the key in the below screen shot is not a working key.) 25. Switch back to Visual Studio and locate the const string apikey entry and replace the abc123 with the copied API key. Be sure to leave the double quotes surrounding the key. 26. Next, locate the Values = new string[,] line of code. 27. Replace the first set of values with the same sample data that we used above for the quick test. 28. You final entry should look like this, 29. Press CTRL + F5 or select Debug, Start Without Debugging to run your client application.

30. Verify the output. 31. Press Enter to close the application and return to Visual Studio. 32. Close Visual Studio, the C# application portion is complete. Create a Python Client Application The steps in this section assume you are using Visual Studio 2015. If you are not using Visual Studio or you are using a different version, you will need to make adjustments to some of the steps as necessary to accommodate your environment. NOTE: This lab assumes a Python 2.7 environment as that is what the sample code targets. If you are using Python 3+ you will need to make changes to the urllib2 entries in the code per the comments in the code file. 1. Start Visual Studio if it is not already open. 2. Click New Project or select File, New, Project. 3. Expand Templates if it is not already expanded. 4. Expand Other Languages. 5. Select Python. 6. Select Python Application. 7. In the Name: text box, give your application a name that makes sense such as AzureMLTestClientPython. 8. Click OK to create the application and project.

9. Visual Studio creates an application stub for you containing an AzureMLTestClientPython.py. You will replace this code with the sample code from the web service API documentation page. 10. Switch back to your browser and locate the Python sample source code. 11. Click the Select sample code button then copy the selected code to the clipboard 12. Switch back to Visual Studio. 13. Highlight the entire code listing in AzureMLTestClientPython.py and delete it. 14. Paste the sample code into the code editor window. 15. Scroll to the top of the code file. If the import urllib2 has an underline, if means you have an incorrectly configured Python environment in Visual Studio or you have Python 3+ installed. Install and configure Python 2.7 for this sample to work. 16. Copy and paste the API key into the api_key variable assignment. 17. Replace the first set of values with the same sample data that we used above for the quick test. 18. You final entry should look like this, 19. Press F5 or select Debug, Start to run your client application. 20. Verify the output. 21. Press Enter to close the application and return to Visual Studio. 22. Close Visual Studio, the Python application portion is complete.

Summary In this lab you have: Prepared and deployed a web service using Azure ML Studio Created a simple client application using C# and Visual Studio Created a simple client application using Python and Visual Studio