




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
CS5100:Founda.onsofAr.?cialIntelligence
IntroductiontoAI,Agents,andPython
Prof.AmySlivaSeptember8,2011
Outline
WhatisAI?
Syllabusandcourseadministration
(Very)briefhistoryofAI
IntelligentAgents
IntroductiontoPython
Whatisar.?cialintelligence?
ArtiEicialsystemswithhumanlikeabilitytothink,understand,andreason(cf.cognitivescience)
SolveproblemstoolargetoEindthebestansweralgorithmically
Heuristic(incomplete)methods
Solveproblemsthatarenotwell--‐understood
Howdowedeterminesuccess?
Gettingthe“rightanswer”?
TheTuringTest(ormodiEiedversions)?
Usefulnessoftheresultingtechniques?
Knowitwhenweseeit?
Ar.?cialsystemswithhumanlikeabilitytounderstandandreason
Maintechniques
Ontologies,automatedreasoning,formallogic,state--‐spacesearch,evidentiallogics(probability,fuzzylogic,…),Bayesianinferencenets,Markovmodels
Applications
Problem--‐solving/planning,naturallanguageprocessing,intelligenceHCI,problem--‐solvingunderuncertainty,decisionsupportsystems(“expertsystems”)
Solveproblemstoolargeto?ndthebestansweralgorithmically
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.vesimplere?exagent
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}
Control?owandfunc.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.ngdirectoriesand?les
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(chǎn)’)
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等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年項(xiàng)目部安全管理人員安全培訓(xùn)考試試題及參考答案一套
- 2024-2025新入職員工安全培訓(xùn)考試試題附完整答案【歷年真題】
- 2025工廠職工安全培訓(xùn)考試試題帶下載答案可打印
- 2025建筑電氣工程分包合同
- 2025年華國某著名服裝品牌省級(jí)銷售總代理合同書(含附加協(xié)議)
- 2025財(cái)政資金借款合同范本
- 2025飲品加盟店合同
- 2025版商務(wù)辦公租賃合同范本
- 2025健身房裝修承包合同范本
- 2025木材采購合同范本
- 人力資源規(guī)劃案例分析題和答案解析
- 大棚建設(shè)鋼結(jié)構(gòu)工程監(jiān)理實(shí)施細(xì)則安全監(jiān)理細(xì)則范本模板
- 梨山老母玄妙真經(jīng)
- 2《建筑機(jī)械使用安全技術(shù)規(guī)程》JGJ33-2012
- 病人呼吸心跳驟停搶救流程
- GB/T 4802.2-2008紡織品織物起毛起球性能的測定第2部分:改型馬丁代爾法
- GB 14934-2016食品安全國家標(biāo)準(zhǔn)消毒餐(飲)具
- 英語高考3500詞帶音標(biāo)
- 泥水平衡頂管施工方案(專家論證)
- 框架結(jié)構(gòu)柱、梁板模板安裝技術(shù)交底
- 呼吸衰竭臨床表現(xiàn)及鑒別診療精編ppt
評(píng)論
0/150
提交評(píng)論