In questa sessione vedremo come realizzare un algoritmo intelligente per giocare a morra cinese (e sue varianti) usando Azure Machine Learning e interagire usando un Bot. In particolare vedremo diverse modalità per predire le mosse dell’avversario rilevando e analizzando pattern da una serie storica e utilizzeremo il nuovo Microsoft Bot Framework e i Cognitive Services per creare un Bot per interagire con l’algoritmo di gioco.
What Are The Drone Anti-jamming Systems Technology?
Human vs Bot: Giocare a Sasso-Carta-Forbici - Matteo Valoriani, Antimo Musone - Codemotion Milan 2016
1. Human Vs Bot
Sasso Carta Forbice
Matteo Valoriani
Antimo Musone
MILAN 25-26 NOVEMBER 2016
2. About US
Matteo Valoriani
Co-Founder Fifth Ingenum Srls.
Community .Net Lombardia
Teaching Assistant Politecnico Milano
Email:matteo.valoriani@fifthingenium.com
Antimo Musone
Co-Founder Fifth Ingenum Srls.
IT Manager / Architect for EY - Italy
Ing. Informatica II Università di Napoli
Email:antimo.musone@fifthingenium.com
3. Target : Rock-Paper-Scissors Bot Game
Routes messages
Manage state
Bot Directory
Session tracking
API / SDK
Channels
Prediction
algorithms
Game Logic
Bot Connector
Bot
Prediction
algorithms
Prediction
algorithms
Web Services
Microsoft
Azure Bot
Microsoft Bot
Framework
Microsoft Azure Function
Azure
Machine
Learning
Azure
Machine
Learning
Azure
Machine
Learning
6. MS Bot Framework
https://dev.botframework.com
A bot is a web service that interacts with users in a conversational format.
Start conversations with your bot from any channel that you’ve configured your bot to
work on Text/SMS, Skype, Slack, Facebook Messenger, and other popular services.
13. Bot Builder SDK for C#
Features:
• Dialogs
• AI
• LUIS
• Stateless
• Scalable
• FormFlow
• GitHub!
http://docs.botframework.com/sdkreference/csharp
To build your bot, the Framework provides a .NET SDK and Node.js SDK.
SDKs provide features such as dialogs and built-in prompts that make interacting with users
The Bot Builder SDK is provided as open source on GitHub ( BotBuilder)
14. Core Concepts
http://docs.botframework.com/sdkreference/csharp
Authentication
The Bot Connector service uses OAuth 2.0 client
credentials for bot authentication.
Conversation
The Bot can have a private conversation with a single
user, or a group conversation with multiple users
including other bots. (not all channels support group
conversations)
Messages
A conversation is a series of message, each message is
an Activity object. When a user sends a message, the
channel that they’re communicating on posts the
message to your bot (web service). Types of messages:
• contactRelationUpdate
• conversationUpdate
• deleteUserData
• Message
• Ping
• typing
18. Microsoft
Cognitive
Services
From faces to feelings, allow your
apps to understand images and video
Hear and speak to your users by filtering noise,
identifying speakers, and understanding intent
Process text and learn how to
recognize what users want
Tap into rich knowledge amassed from
the web, academia, or your own data
Access billions of web pages, images, videos, and
news with the power of Bing APIs
19. Cognitive Services
Emotion
Speaker
Recognition
Speech
Custom RecognitionComputer Vision
Face
Video
microsoft.com/cognitive
SearchSpeech Language KnowledgeVision
Linguistic Analysis
Language
Understanding
Bing Spell Check
Entity Linking
Knowledge
Exploration
Academic
Knowledge
Bing
Image Search
Bing
Video Search
Bing
Web Search
WebLM
Text Analytics Recommendations
Bing
Autosuggest
Bing
News Search
Translator
20. Cognitive Services
Emotion
Speaker
Recognition
Speech
Custom RecognitionComputer Vision
Face
Video
SearchSpeech Language KnowledgeVision
Linguistic Analysis
Language
Understanding
Bing Spell Check
Entity Linking
Knowledge
Exploration
Academic
Knowledge
Bing
Image Search
Bing
Video Search
Bing
Web Search
WebLM
Text Analytics Recommendations
Bing
Autosuggest
Bing
News Search
Translator
microsoft.com/cognitive
25. Language Understanding Models
Reduce labeling effort with interactive featuring
Application Integration
Deploy using just a few examples with active learning
Supports 5 languages (English, Chinese, Italian, French, Spanish)
Learning Process :
Language Understanding Models
Build and connect intelligent bots to interact with your users naturally wherever they are — from your website or app to text/SMS, Skype, Slack, Facebook Messenger, Office 365 mail, Teams and other popular services
A bot is a web service that interacts with users in a conversational format. Users start conversations with your bot from any channel that you’ve configured your bot to work on (for example, Text/SMS, Skype, Slack, Facebook Messenger, and other popular services).
You can design conversations to be freeform, natural language interactions or more guided ones where you provide the user choices or actions.
The conversation can utilize simple text strings or something more complex such as rich cards that contain text, images, and action buttons.
Microsoft Bot Framework is a comprehensive offering that you use to build and deploy high quality bots for your users to enjoy wherever they are talking. The framework consists of the Bot Builder SDK, Bot Connector, Developer Portal, and Bot Directory. There’s also an emulator that you can use to test your bot.
Connector : is a component which provides a single API for your bot to communicate across multiple client services such as Skype, Email, Slack.
Builder
Directory
When you finish writing your bot, you need to register it, connect it to channels, and finally publish it. Registering your bot describes it to the framework, and it’s how you get the bot’s app ID and password that’s used for authentication. Bots that you register are located at My bots in the portal.
After registering your bot, you need to configure it to work on channels that your users use. The configuration process is unique per channel, and some channels are preconfigured for you (for example, Skype and Web Chat). For information about configuring channels, see Configuring Channels. The framework also provides the Direct Line REST API, which you can use to host your bot in an app or website.
Message typeDescription contactRelationUpdateThe channel sends this message to indicate that the user added or removed your bot from their contacts list in the channel. If the user added your bot to their contacts list, the message’s action property is set to add; otherwise, it’s set to remove.conversationUpdateThe channel sends this message to indicate that one or more users joined or left the conversation, or the topic name changed. For a list of users that joined the conversation, see the message’s addedMembers property; otherwise, see the removedMembers property. You can use this message to welcome new users to the conversation.deleteUserDataThe channel sends this message to indicate that the user wants the bot to delete all of their personally identifiable information (PII) that the bot may have saved using the User State REST API. If you receive this message, you must delete the user’s data. After you delete the user’s data, you should send them a message indicating that it’s deleted.messageThe bot or user sends this message to advance the conversation. For example, the user sends a message asking for information, and your bot replies with a message that answers the user’s question. Most messages that you send and receive will be of this type.pingThe bot is sent this message to verify that it’s URL is accessible. The bot should respond with HTTP status code 200 OK, and may respond with 401 Unauthorized or 403 Forbidden.typingThe channel or bot sends this message to indicate to the other that they’re working on a reply. Not all channels support this message.
Most messages that your bot will send and receive are of type message. To reply to a user’s message, create a new Activity object and set, at a minimum, the following properties:
PropertyDescriptionconversationSet this to the contents of the conversation property from the user’s message.fromSet this to the contents of the recipient property from the user’s message.localeSet this to the contents of the locale property from the user’s message, if specified.recipientSet this to the contents of the from property from the user’s message.replyToIdSet this to the contents of the id property from the user’s message.typeSet this to message.
One of the key problems in human-computer interactions is the ability of the computer to understand what a person wants, and to find the pieces of information that are relevant to their intent.
LUIS is designed to enable you to very quickly deploy an http endpoint that will take the sentences you send it, and interpret them in terms of the intention they convey, and the key entities like "virtual reality companies" that are present. LUIS lets you custom design the set of intentions and entities that are relevant to the application, and then guides you through the process of building a language understanding system.
Hierarchical Entities
For example, a generic entity may be called “Date” and the specific children of this parent may be called “StartDate” and “EndDate”
Composite Entities
In a flight booking app, a user may say “Book 2 adult tickets to Paris next Monday”. In this example, we may create a composite entity called “Tickets”, including the component entities “number” and “category” to capture the number and category of tickets to be booked. If not already existing, you need to define both entities before defining the composite.
Train
When you "train" a model, LUIS generalizes from the examples you have labeled, and develops code to recognize the relevant intents and entities in the future
Publishing a Model
The next step is to deploy the models in an HTTP endpoint that will interpret the sentences we send it.