版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
CS5100:Founda.onsofAr.ficialIntelligence
IntroductiontoAI,Agents,andPython
Prof.AmySlivaSeptember8,2011
Outline
WhatisAI?
Syllabusandcourseadministration
(Very)briefhistoryofAI
IntelligentAgents
IntroductiontoPython
Whatisar.ficialintelligence?
ArtiEicialsystemswithhumanlikeabilitytothink,understand,andreason(cf.cognitivescience)
SolveproblemstoolargetoEindthebestansweralgorithmically
Heuristic(incomplete)methods
Solveproblemsthatarenotwell-‐understood
Howdowedeterminesuccess?
Gettingthe“rightanswer”?
TheTuringTest(ormodiEiedversions)?
Usefulnessoftheresultingtechniques?
Knowitwhenweseeit?
Ar.ficialsystemswithhumanlikeabilitytounderstandandreason
Maintechniques
Ontologies,automatedreasoning,formallogic,state-‐spacesearch,evidentiallogics(probability,fuzzylogic,…),Bayesianinferencenets,Markovmodels
Applications
Problem-‐solving/planning,naturallanguageprocessing,intelligenceHCI,problem-‐solvingunderuncertainty,decisionsupportsystems(“expertsystems”)
Solveproblemstoolargetofindthebestansweralgorithmically
Maintechniques
Heuristicsearch,dependency-‐directedbacktracking
Applications
Productionschedulingandotherconstraintsatisfactionproblems,gameplaying
Acomponentinlarge-‐scalereasoningandplanningsystems
Solveproblemsthatarenotwell-‐understood
Maintechniques
Weightedrule-‐basedsystems,Bayesianinferencenets,statisticalinductionandmachinelearningingeneral
Applications
Finance,searchengines,computationalscience(discovery),datamining
Computervision:systemsthatseeandrecognizeobjects
Gooversyllabus
HistoryofAI
1960s—Initialoptimism
EarlyML
Samuel’sCheckersplayer
GeneralProblemSolver(GPS)—Simon&Newell
Employedmeans-‐endsanalysis(precursorofbackwardchainingnowusedinmanysystems)
MatchAtoBtoEinddifferenceD
Subgoal:ReduceD
A’
TransformA’intoB
Goal:TransformsituationAtosituationB
fail
none
Success Fail Fail
fail
Moreonmeans-‐endsanalysis
Goal:ReducedifferenceDbetweensituationsAandB
Success
SearchforoperatorQrelevantforreducingD
Subgoal:ApplyQtoAproducingA’
A’
none
fail
Fail
Goal:ApplyoperatorQtoA
MatchAtotheconditionsofQ,EinddifferenceF
A’’
Subgoal:ReduceF ApplyQtoA’’
A’
Success
none
failFail
failFail
HistoryofAI(cont.)
1970s-‐mid80s—Knowledge-‐basedsystems
“Micro-‐world”experiments
SHRDLU(TerryWinograd)
Rule-‐based“expert”systems
DENDRAL,MYCIN(EdFeigenbaum)
Acceptancebyindustry—hugeoversell
Theknowledgeacquisitionbottleneck
HistoryofAI(cont.)
Late80s–mid90s—AIWinter
Hopespinnedonneuralnets/MLtoovercomeKAbottleneck
Late90stopresent—morecomputingpower
Riseofprobabilisticapproaches
LexicaltaggingbreakthroughinNLP
Morerigorousexperiments/evaluationmethods
2000s—inEluenceofthewebrevivesAI
MassivetextcorpusesandneedforbetterwebbrowsersinspireNLP
Hardwareadvancesinspirerobotics
Intelligentagents/webbots—applicationstoe-‐commerce
Environment
Agent
Sensors
Percepts
Actuators
Actions
?
Agentsandenvironments
Frameworkforintelligentagentdesign
Whatcantheagentdo?(rangeofpossibleactions)
Whatabouttheenvironment?
Inputstotheprogramarecalledpercepts
Symbolicinputfromkeyboard,Eiles,networks
Sensordatafromthephysicalworld
Oftenmustbeinterpretedintomeaningfulconcepts
Whatcantheagentknow?
Historyofitsownpreviousinputsandactions
Propertiesoftheenvironmentandworldknowledge
Knowledgeofitsowngoals,preferences,etc.
Strategiesforitsbehavior
Describetheagent’sbehaviorwithanagentfunction
Mappingofanyperceptsequencetoanaction
Implementedinternallybytheagentprogram
Vacuum-‐cleanerworld
B
A
Percepts:locationandcontents,e.g.,[A,Dirty]
Actions:Left,Right,Suck,NoOp
Typesofagents
SimplereElexagent
No“state”ormemory
Reactstocurrentinputaccordingtoitsprogram(rulesoftheform“ifconditionthenaction”)
Model-‐basedagent
Usesanexplicitknowledgebasetomodeltheenvironment
Howdoestheenvironmentevolveindependently
Howdoestheagentaffecttheenvironment
Exhibits“understanding”ofitsinputbyrelatingittopriorknowledge
Reactsaccordingtorules
Conditionsmaybecomplexandrequireinferencetoevaluate
Typesofagents(cont.)
Planningagents(goal-‐basedandutility-‐basedagents)
Explicitlyrepresenttheirowngoalsand/orpreferences
(“utilities”)andcanreasonaboutthem(i.e.,planning)
Exhibitautonomy—actionsdonotfollowdirectlyfromrule-‐basedlookup
Learningagents
Supervisedlearning—Learnfrompositiveandnegative
examples
Reinforcementlearning—Learnfromexperiencetoimproveitsoutcomes
Agentprogramimplementa.on
Table-‐drivenapproach—intractable
Uselookuptabletomatchthesequenceofperceptstoanaction
Embeddedrepresentation—speciEictooneenvironment
Programstatements:
ifstatus=DirtythenreturnSuck
elseiflocation=AthenreturnRight
elseiflocation=BthenreturnLeft
Declarativerepresentation—general
Programstatements:
Useproductionrulebase:conditionaction
Ifperceptmatchesconditionthenreturnaction
B
A
Agent
Sensors
Condition-actionrules
Actuators
WhatactionIshoulddonow
Whattheworldislikenow
Environment
Declara.vesimplereflexagent
Drawbacksofproductionrulesystems
HUGErulebase—timeconsumingtobuildbyhand
WhatifmorethanoneconditionissatisEied?
InElexible(noadaptationorlearning)
Represen.ngagentknowledge
Q:Whatformallanguage(s)canweusetorepresent
Currentfactsaboutthestateoftheworld?
Amodelofhowtheworldbehaves?
Amodeloftheeffectsofactionsthattheagentcanperform?
Theproductionrulesthatspecifyagentbehavior?
A:Formallogic
Syntaxandsemanticsarewellunderstood
Computationaltractabilityknownforimportantsubsets(e.g.,Hornclauselogic)
Howdowedeterminesuccess?
Gettingthe“rightanswer”?
TheTuringTest(ormodiEiedversions)?
Havingagoodoutcome?(usingsome“utility”function)
Knowitwhenweseeit?
Analyzingagentperformance
Rationalagentisonethatdoesthe“right”thing
MustdeEineaperformancemeasure
Costs(penalties)andrewards
Choosesanactionthatmaximizesexpectedscore
Rationalitydependson
SuccesscriteriondeEinedbyperformancemeasure
“Behavior”oftheenvironment(e.g.,canacleansquaregetdirtyagain?)
Possibleactions
Perceptsequence
Autonomy
Rationalagentsrequirelearningtocompensateforincorrectorincompletestartingknowledge
Introduc.ontoPython
DevelopedbyCWIin1989
Features
Interpreted
Dynamictyping
Easilyreadablecodeblocks
Object-‐oriented—alldataisrepresentedbyobjectsorrelationsbetweenobjects
GoodforAI—easytolearn,easytoimplementAIconcepts
Wewilluserelease2.x
Wri.ngandrunningPython
Interpreter
python<Eile>.py
Executesthestatementsin<Eile>.py
Interactivemode
Executablescripts
#!/usr/bin/envpython
Idle
PythonIDEpackagedwiththedownload
Automaticblockindentionandtexthighlighting
SomeEMACSkeyswork
Debugger
SimplePythonexample
Let’sstartwitha(very!)simpleexample
#ThisisaPythonprogramx=37
y=x+5printy
%pythonsimple.py
42
%
Variablesneednotbedeclared,butmustbeassigned
Linebreaksseparatestatements
Commentsbeginwith#
Variableassignments,numbers,andstrings
Variableassignmentwith=
>>>x=y=42
Straightforwardmathexpressionsusing+,-‐,*,/,and()
>>>(50-5*6)/4
5
SupportforEloatingpointandmixedcomputation(convertalloperandstoEloatingpoint)
>>>3*3.75/1.5
7.5
Stringscanbeenclosedineithersingleordoublequotes
“python”or‘python’
Indexingwith[]
Muli-‐linestringsareenclosedintriplequotesorendin\
Concatenationwith+andrepetitionwith*
>>>“str”*3“strstrstr”
Datastructuresandcompounddatatypes
Lists—commaseparatedvaluesenclosedby[]
>>>l=[“hello”,“world”,42]
[“hello”,“world”,42]
>>>nl=[[2,3],[4,5]]
Listcomprehension—listsresultingfromevaluatingexpressions
>>>vec=[2,3,4]
>>>[3*xforxinvec][6,9,12]
Tuples—groupofvaluesseparatedbycommas
>>>
t
=1,5,9
#tuplepacking
(1,
>>>
5,
x,
9)
y,z=t
#tupleunpacking
>>>t=()
>>>t=“singleton”,
Slices—subsetoflist(orstring)
DeEinedbytwoindices
>>>slicedString=aString(start:end)
>>>slicedList=aList(start:end)
Dic.onaries
Unorderedsetsofkey:valuepairs(Associativearrays)
Indexedbyuniquekeys
Keysmustbeimmutabletypes(i.e.,strings,numbers)—canusetuplesonlyiftheycontainimmutableelements
>>>grades={}
>>>grades={“joe”:93,“sally”:82}
>>>grades[“bill”]= 87
>>>grades
{“bill”:87,“sally”:82,“joe”,93}
Constructdictionariesfromalistofkey:valuetuples
>>>dict([(“joe”,93),(“sally”,82),(“bill”,87)])
{“bill”:87,“sally”:82,“joe”,93}
Controlflowandfunc.ons
ifstatements(conditionals)
>>>
…
ifx<
0
‘Negative’
…
…
elif
x
=0:
‘Zero’
…
else:
‘Positive’
while-‐-‐continueloopinguntilconditionisfalse
>>>a,b=0,1
>>>whileb<1000
… printb
… a,b=b,a+b
for—iterationoverasequence
>>>
a=
[1,6,15]
>>>
…
for
xina:
printx
range()function—createssequencesusefulforiteration
Indentation—requiredforgroupingstatements
FunctiondeEinitions
>>>deffib(n):#Fibonacciseriesuptonusingabovewhile
Manipula.ngdirectoriesandfiles
Accessmodulesusingimportkeyword
OSmodule—accessoperatingsystemdependentfunctionality
os.path—modulewithusefulfunctionsforpathnames(e.g.,normalizeabsolutepaths,Einddirectories,…)
os.getcwd()—returnsstringwhichnamescurrentdirectory
os.chdir("C:/")oros.chdir("C:\\")—changethecurrentworkingdirectorytothespeciEiedpath
ReadingEiles
open(name,mode)—nameistheEilename,modeisread(‘r’),write(‘w’),orappend(‘a’)
ReturnsFileobject
IfnomodeisspeciEieddefaultsto‘r’
>>>
myfile=open(“…”)
>>>
s=myfile.readline()
#stringcontainingthenext
line
>>>ss=myfile.readlines()#listcontainingalllines
TwoapproachestoreadingdatastructuresfromEiles
[Yes,Happy]user=pfile.readline()andthenparseitintoalist
[‘Yes’,‘Happy’]usep=eval(pfile.readline())
Classesandobjectorientedprogramming
ClassdeEinitionsandinstantiation
>>>classC1:...
>>>I1=C1()
Inheritance
>>>classC2(C1):…
Classattributesandmethods
>>>classC2(C1):
… data=value
… defsetname(self,who):
… =who
ClassattributesdeEinedattoplevelaresharedbyallinstances,butchangestothevalueonlyaffecttheinstance
self—selfreferencetocurrentinstance
Constructormethodnamedinit
Methodscanbeaccessedasunbound(atclasslevel)orboundtoaninstance
Overloadoperatorsforclasses
>>>classC1:
… defadd(self,other)
… returnC1(self.data+other)
Formorehelp…
SeetheResourcespageontheclasswebsite
Checkouttheexampleprogramscount.py,match.py,oodemo.pyandthevacuumagentimplementedwithPython
VisitthePythontutorial
Assignment1
ARela.onalAgentinPython
Arela.onalagentprograminPython
Objective:
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年蛭石项目投资申请报告
- 2023年供暖设备资金申请报告
- 宏观经济学(山东大学)-知到答案、智慧树答案
- 2024年不粘锅项目资金申请报告代可行性研究报告
- 2023年支架资金申请报告
- 2024年锰铁项目投资申请报告代可行性研究报告
- 2023年灯座投资申请报告
- 2023年服装设计资金申请报告
- 房地产:2024年4月上海土地招拍挂市场
- 2024年电银项目资金申请报告代可行性研究报告
- 滑膜炎干细胞治疗研究
- 安定古镇旅游策划方案
- 余映潮阅读教学好课设计
- 工业互联网环境下的工业大数据采集与应用
- 《未若柳絮因风起》课件
- 快消品行业招商方案
- 铁路自轮运转车辆驾驶资格理论考试安全规章培训教材题库 精简版题库(457道)
- 高处作业吊篮危险源辨识及风险评价表
- 无神论讨论发言稿
- 2023年襄阳樊城区城市管理协管人员招考(80人)考前自测高频考点模拟试题(共500题)含答案详解
- 桁架安全评估报告
评论
0/150
提交评论