




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年計(jì)算機(jī)二級(jí)考試重點(diǎn)解析試題及答案
- 消防培訓(xùn)內(nèi)容試題及答案
- 獸醫(yī)職業(yè)認(rèn)同感的提升策略試題及答案
- 了解2024年全球貧困問(wèn)題與地理的試題及答案
- 2025年貴州省安全員B證考試題庫(kù)及答案
- 家庭教育指導(dǎo)師提升能力方法試題及答案
- 2025年-黑龍江省建筑安全員A證考試題庫(kù)
- 物流服務(wù)師財(cái)務(wù)管理試題及答案
- 電商客戶服務(wù)管理試題及答案
- 生態(tài)環(huán)境與經(jīng)濟(jì)發(fā)展:2024年試題及答案
- 應(yīng)用文寫(xiě)作全套優(yōu)質(zhì)課件(修改稿)
- 礦井井底窄軌線路設(shè)計(jì)方案
- 施工企業(yè)安全生產(chǎn)評(píng)價(jià)匯總表
- 聽(tīng)覺(jué)理解能力評(píng)估記錄表
- 安徽省中等職業(yè)學(xué)校優(yōu)秀教學(xué)軟件(微課)
- 優(yōu)化營(yíng)商環(huán)境條例學(xué)習(xí)解讀原創(chuàng)精品課件PPT模板
- 陰滋病的課題:拉開(kāi)攻破的序幕
- 2022年研究生復(fù)試神經(jīng)外科題庫(kù)
- 904L材料焊接工藝設(shè)計(jì)規(guī)程
- 下肢靜脈曲張硬化治療指南
- 博士力士樂(lè)cvf變頻器使用手冊(cè)
評(píng)論
0/150
提交評(píng)論