Download Intro_to_Artificial_Intelligence - 91-514-s2011

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

The Measure of a Man (Star Trek: The Next Generation) wikipedia , lookup

Pattern recognition wikipedia , lookup

Data (Star Trek) wikipedia , lookup

Time series wikipedia , lookup

Transcript
Intro to Artificial Intelligence &
Google Prediction API
1
Pawan Gupta
First definition of AI
"AI is the study of making computers do things, at which, at the
moment, people are better"
-- Elaine Rich (author of Artificial Intelligence book)
There are still many domains where its better to rely on human
to solve problems than computers.
For example : teaching programing course to novice
2
Computers advantage
Computers are better than human beings in:
• Numeric Computation
• Information Storage
• Repetitive Operation
• Example
o
o
Land aircraft safely
Ability to beat virtually any human being in the chess.
3
Human advantages
Human beings are better than computers in:
• Common Sense/Judgement
o
o
Crossing a road
Driving in busy city like New York and Boston
• Language, speech, understanding scene, emotions, and
expression situation
o
Player emotions vs Video game
4
Algorithm Vs Non-Algorithm
Algorithm is a systemic method in which a sequence of
steps/instructions are mentions, and each step/instruction can
takes finite amount of time.
Non-algorithm method, we may not have definite sequence of
steps to follow. Example crossing road.
5
"Measure three times before you cut
once" - Proverbs
• Computers takes instructions from human and then do the
task. without thinking if instructions user gave is right or not.
• Garbage in and Garbage out
• Human can take garbage as an input, but may think it twice
before its provide output.
6
Google Prediction API
•
•
•
•
•
Making prediction based on data provided
Machine learning as a Web Service
It is a RESTfull HTTP service
Only HTTPS protocol is supported
Development Warning:
o
o
"Not a crystal ball"
Not fully ready yet, a lot more work to be done.
7
Process
Steps to use Prediction API
1. Prediction API Account access
2. Build a data model
3. Upload training data to Google cloud
4. Train the system with the data
5. Send a query
8
Commands
• $ ./oauth-train.sh
• $ ./oauth-check-training.sh
• $ ./oauth-predict.sh
9
Authentication Types
• clientLogin
• login credentials is validated only once per
session
• clientLogin is designed for desktop application
• oAuth
• Better user interface
• oAuth designed for web applications
• Secure user credential
• Required Account access: Google storage for dev &
Prediction API account
10
Build a data Model
• Data format: comma separated value format(CSV)
• Two values –Answer and data column
• Cannot mix numbers and categorical data
•
•
•
•
•
One data file per model
One example per line
Text is case-sensitive
Data can be numeric or unstructured text
Data cannot be more than 100M
11
Numeric vs. Categorical model
• Numeric
• Return numeric value (Google example)
•
•
•
•
•
•
Temperature City
Day_of_year Weather
52,
"Seattle“, 283,
"cloudy"
64,
"Seattle“,
295,
"sunny"
60,
"Seattle“, 287,
"partly_cloudy"
query "Seattle,288,sunny", return 63
Bad query “288, sunny, Seattle”
• Categorical
• Return string value
•
•
•
•
Description
Subject line
"spam" ,
"Get her to love you"
"spam" ,
"Lose weight fast!"
query "You can lose weight now!" return “spam”
12
Data Example
• "english" = "The patriots are the best team in the
league"
• "Hindi" = "आज बहुत अच्छा दिन है “
• "French", "Je ne vous parle pas, monsieur."
• "Spanish", "Soneto"
• "English", " * * * * * * *" (Bad data)
• "Spanish", "YO, EL REY."
• "French", "-- Ah! fit d'Artagnan."
• " Latin", " Non bene pro toto libertas venditur auro."
13
Upload data
• Create a bucket
• gsutil mb gs://classexample (follow Google guidelines)
• Copy data to bucket
• $ gsutil cp ./language_id gs://classexample/language_id
14
Train system
• To Train
• $ ./oauth-train.sh classexample/language_id
• To check
• $ ./oauth-check-training.sh classexample/language_id
• Return :
•
{"data":{"data":"classexample/language_id","modelinfo":"Training has
not completed."}}
• Try again
• $ ./oauth-check-training.sh classexample/language_id
• Return :
•
{"data":{"data":"classexample/language_id","modelinfo":"estimated
accuracy: 0.95"}}
15
Send Queries
• Send queries
– $ ./oauth-predict.sh classexample/language_id "Today is Monday.
The New york City"
– return {data: {"input" : { "mixture" : [ " Today is Monday. The New
york City " ]}}}{"data":{"kind":"prediction#output",
"outputLabel":"english",}}
• outputLabel value shows best guess
16
Languages
• Prediction API libraries available in following programming
languages:
•
•
•
•
•
•
.Net
BASH
JavaScript
PHP
R (Google Prediction Client Library for R)
Ruby
17
Google Recommendation
• Think carefully when uploading train data
• More examples (in millions), predict better results
• Query must match same number of arguments as features
• “english” , “Today is good day”
• Good query : “How is your car running”
• Bad query : “ How is your car running”, “What day is today”
18
Summary
• When not following steps and using judgment to solve
problem, then its a field of AI.
• If series of steps can be follow to solve problem, its better to
use Algorithm. Its faster and cheaper way.
• Prediction API is just a proof of concept yet
• REMEMBER: Data model learn from the file you upload, NOT
from queries.
• Other examples that are equaling to Prediction API
• Email Rules or Filters
• Amazon recommendation
• Automation
19
References
• http://code.google.com/apis/predict/
• http://en.wikipedia.org/wiki/Artificial_intelligence
20