Sample JAVA app for RRS

By for April 4, 2016

Report Abuse
JAVA app template for making real-time predictions using Azure ML APIs.
> **Note:** This is depreciated. #Build a Predictive App using JAVA and Azure ML# ##Overview## In this tutorial, we will walk through creating an JAVA app that can consume an Azure ML RRS API. For this example, we will be using the free version of NetBeans IDE. ##Create the Web Service API## While you can use any experiment you want, for this example we are using the "Income Prediction data" sample experiment from the Azure ML Gallery. We train the model, create a Predictive Experiment, then deploy it as a web service. We will call the Request-Response API created here from our JAVA app to predict if the person's income is <= 50K or > than 50K. ![][1] ##Create a Netbeans Project## First download the project from GitHub, then download Apache HttpComponents . Once you unzip everything into their respective folders, copy the HttpComponents lib folder into your main directory for the RSS app: ![][2] In NetBEans IDE, open the AzureML_RSSApp-master project. Build the project. ##The Application Code## Reading the JSON schema from the file rssJson.json: ![][3] Reading the API key and API URL of Azure ML request response REST API: ![][4] Call REST API for retrieving prediction from Azure ML ![][5] Main program with the two command line arguments, JSON and API info file names: ![][6] ##Test the Project## Update the apiinfo.txt file with your API key on your Studio Dashboard: ![][7] You also need to update the API end point in the APIinfo file with the API end point from the Studio Request/Response page: ![][8] ![][9] To ensure the values in the json file match what the program is expecting, click test: ![][10] And make sure the names in the test dialog match what is in the json file. You can also go into Studio, open your experiment, click on the visualize data and see the values for each field. ![][11] The dataset opens in Excel: ![][12] Once built, you will need to run it with two parameters: java AzureML_RRSApp <jsonFilename> <apiInfoFilename> In a Windows command line, it looks like this: ![][13] ##Summary## In this tutorial, we used NetBeans to create a simple JAVA app that can use Azure ML APIs to do real-time predictions. [1]: [2]: [3]: [4]: [5]: [6]: [7]: [8]: [9]: [10]: [11]: [12]: [13]: