Deploy bot application to Azure and register in Microsoft Bot Framework

Create your first chat bot application using Microsoft Bot Framework

Publish Application to Azure

  • Right click on the web application and click publish

01

  • Create Microsoft App Service
  • Select Microsoft Azure App Service
  • Click publish

02

  • Type App name, choose subscription, resource group, app service plan
  • Click create

03

  • Application is deployed to azure and you will see the following page in the browser
  • You will see the azure application url
  • You will get message end point

04

Register Bot with Microsoft Bot Framework

  • Go to https://dev.botframework.com/
  • Click to My bot -> Create bot
  • Click Create button
  • You will redirect to Azure portal
  • Click “Web App bot” and then click create

05

Create new bot service

  • From Web App Bot -> Click the “Create button” to start the bot creation process.
  • Type bot name
  • App name
  • You can keep other option by default or change as your own

06

07

Obtain Microsoft App Id and Microsoft App Password

  • Click settings of newly created bot service
  • Change message end point

08

  • Click Mange (beside Microsoft App id) link
  • Click Generate new password and obtain new Microsoft app id and password and then save

09

  • Now open web.config of bot application and add Microsoft App Id and password.
  • Publish application again to azure

10

  • Now go to Web App bot in Azure
  • Click Test in Web Chat
  • In the right side window. Type some message and enter.
  • You will see the following reply.

11

If it replied above message, means its ok. Cheers !!

Create your first chat bot application using Microsoft Bot Framework

What is chatbot?

  • Bot is an automated software designed by human programmers to do tasks
  • Chatbot is an automated software to talk customer using messaging apps

Why Chatbot?

  • One to one messaging with thousands of customers at a time
  • Available in 24/7
  • Lots of application in real world
    • Bank and Insurance
    • HR issues
    • Ordering Pizza
    • Customer support
    • Personal Finance Assistant
    • Schedule Meeting
    • Product Suggestions
    • Weather forecasting etc.

What is Microsoft Bot Framework?

  • A platform for building, connecting, testing and deploying powerful and intelligent bots
  • Open source
  • Connect cross platform with the flip of a switch

Installation Requirements

  • Visual Studio 2015 / 2017 (In this demo I use Visual Studio 2017)
  • Download Bot template: Visual Studio Bot Template – C# (http://aka.ms/bf-bc-vstemplate )
  • Save the zip file to Visual Studio 2015/2017 template directory
    “%USERPROFILE%\Documents\Visual Studio 2017\Templates\ProjectTemplates\Visual C#”
  • Create First Application
    • Start Visual Studio 2017
    • From the file -> New->Project
    • Select Visual C# template
    • Select Bot Application
    • Enter project name (For example DigitalAssistant)
    • Browse save location
    • Click OK

    01

    • A bot application with default structure will be created.
    • Default project structure of a bot application shown below

    02

    Now run your application, you will see the following screen.

    03
    If you see the above screen, means your application is created successfully.

    Test your project using bot emulator

    • Download bot emulator from the following link
    • https://github.com/Microsoft/BotFramework-Emulator/releases/download/v3.5.32/botframework-emulator-Setup-3.5.32.exe
      Install bot emulator
    • Test your project by typing http://localhost:3979/api/messages in the emulator url
    • Click Connect button of the emulator
    • Now type some message in the emulator
    • You will see the following screen
    • If you see the reply message like this, it means its means it works properly.

    04

    Next: Deploy bot application to Azure and register in Microsoft Bot Framework

    A simple data science experiment with Azure Machine Learning Studio

    What is Machine Learning, data science and Azure Machine Learning Studio?

    • Machine Learning is concerned with computer programs that automatically improve their performance through experience. It learns from previous experience or data.
    • Data science, also known as data-driven science, is an interdisciplinary field about scientific methods, processes, and systems to extract knowledge or insights from data in various forms, either structured or unstructured, similar to data mining. (Wikipedia)
    • Azure Machine Learning Studio is a tool that uses to develop predictive analytic solutions in the Microsoft Azure Cloud.

    Experiment Overview
    Azure Machine Learning Studio is an excellent tool to develop and host Machine Learning Application. You don’t need to write code. You can develop an experiment by drag and drop. Here we will create a simple Machine Learning experiment using Azure Machine Learning Studio.

    Tools and Technology used

    1. Azure Machine Learning Studio

    Now create our experiment step by step

    Step 1: Create Azure Machine Learning Workspace

    • Go to https://portal.azure.com and log in using your azure credential
    • Click More Services from left panel of azure portal
    • Click “Machine Learning Studio Workspace” under “Intelligence + Analytics” category
    • Add a work space by clicking add (+) button at the top left corner
    • Choose pricing tire and select. Figure shows pricing tire below.
    • Finally click create button

    001

    002

    Step 2: Launch Machine Learning Studio

    • Click Launch Machine Learning Studio to launch machine learning studio
    • Then login to the portal

    003

    Step 3: Create a blank experiment

    • Select Experiment Menu. Then click New (+), at the bottom left corner.
    • Click Blank Experiment. In addition to blank experiment there are many other sample experiments. You can load and modify the experiment.
    • Once the new blank experiment has been loaded, you will then see the Azure ML Studio visual designer as follows.

    004

    005

    Step 4: Add data set in the ML Studio visual designer

    • You can import data set or can use saved data set. In this case we use saved sample dataset.
    • Click Saved Datasets from left top corner.
    • Drag and drop “Adult Census Income Binary Classification dataset” from Saved Datasets -> Sample

    006


    Step 5: Select columns in dataset

    • Expand Data Transformation -> Manipulation
    • Drag and drop “Select Columns in Dataset” to the visual surface
    • Connect the “Dataset” with “Select Columns in Dataset” in visual surface
    • Click the Select Columns in Dataset
    • Click Launch column selector in the property pane
    • Select “WITH RULES”
    • Add age, education, marital-status, relationship, race, sex, income columns and finally click tick mark of the bottom right corner.

    007

    008

    Step 6: Split up the dataset

    • Split your input data into two – Training data and Validation data
    • Expand “Data Transformation” -> “Sample and Split” from left pane
    • Drag and drop Split Data to Azure Machine Learning Studio visual surface
    • Connect the split module with “Select Columns in Dataset” in visual surface
    • Click the Split module and set the value of the Fraction of Rows to 0.80 in the right pane of the visual designer surface. This means 80 percent data will be used for training and rest of the data will be used for validation.

    009

    Step 7: Train the model

    • Expand “Machine Learning” -> “Train” from left pane
    • Drag and drop “Train Model” to Azure ML Studio visual surface
    • Connect split dataset1 to train model (second point of train model as figure below)
    • Expand Machine Learning -> Initialize Model -> Classification from left pane
    • Drag and drop “Two-Class Boosted Decision Tree” as shown figure
    • Connect “Two-Class Boosted Decision Tree” to Train Model (first point of train model as figure below)

    010


    Step 8: Choose columns for prediction

    • Click the Train Model
    • Click “Launch column selector” in the property pane
    • Select Include and add column name “Income”. Because this experiment will predict income.
    • Click tick mark on the bottom right corner

    011

    Step 9: Score the model

    • Expand “Machine Learning” -> “Score”
    • Drag and drop “Score Model” to the visual design surface.
    • Connect Train Model to Score Model (first point of Score Model as figure below)
    • Connect “Split” to “Score Model” (second point of Split with Second point of Score Model as figure below)

    012


    Step 10: Evaluate the model

    • Expand “Machine Learning” -> “Evaluate”
    • Drag and drop “Evaluate Model” to the visual design surface.
    • Connect “Score Model” to “Evaluate Model” (first point of Evaluate Model as figure below)
    • Now click “Run” at the bottom of the Azure ML Studio. After processing, if you see each stage marked as green, means its ok.
    • After completing process, right click on the Evaluate Model -> Evaluation Result -> Visualize
    • You will see the accuracy curve as shown below.
    • Click Save As at the bottom of the screen

    013

    014

    015

    Step 11: Setup a web service

    • Click Setup Web Service -> Predictive Experiment
    • Connect Web Service Input to Score model (As shown below figure)
    • Select “Column in Dataset”, remove income column from dataset. Because model is now ready to predict income.
    • Save and run the model from bottom of the ML studio

    016

    017

    018

    Step 12: Deploy Web Service

    • Click Deploy Web Service -> Deploy Web Service [Classic] from the bottom of ML Studio
    • After completing deployment process, you will see a dashboard. Here you will see different documents to test and consume services as shown below
    • Click “Test Button” from the Dashboard
    • You will see a popup dialog to take input
    • Type input as like below and Click Tick mark
    • You will see desired output as like figure. Here you see income > 50K

    019

    020

    021

    Now you have developed a simple data science experiment. You can now embed this with your application. API links, security key and necessary document is given in the dashboard.