![如何進(jìn)化生活在計(jì)算機(jī)中使用Python_第1頁(yè)](http://file4.renrendoc.com/view14/M08/09/13/wKhkGWYcqliACpK0AACa_CGDy78422.jpg)
![如何進(jìn)化生活在計(jì)算機(jī)中使用Python_第2頁(yè)](http://file4.renrendoc.com/view14/M08/09/13/wKhkGWYcqliACpK0AACa_CGDy784222.jpg)
![如何進(jìn)化生活在計(jì)算機(jī)中使用Python_第3頁(yè)](http://file4.renrendoc.com/view14/M08/09/13/wKhkGWYcqliACpK0AACa_CGDy784223.jpg)
![如何進(jìn)化生活在計(jì)算機(jī)中使用Python_第4頁(yè)](http://file4.renrendoc.com/view14/M08/09/13/wKhkGWYcqliACpK0AACa_CGDy784224.jpg)
![如何進(jìn)化生活在計(jì)算機(jī)中使用Python_第5頁(yè)](http://file4.renrendoc.com/view14/M08/09/13/wKhkGWYcqliACpK0AACa_CGDy784225.jpg)
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
HowtoEvolveLifeinaComputerusingPython
BertChan
BigDataConsultant@ASL
PyConHK/CodeConf2018
Programminginthe1990’s
PC:80286(8MHz,8MBRAM)
OS:MS-DOS(Win3.1tooslow!)
Pascal
Simulatelife
Simulategravity,fractals
Hack&decodegames
Assembly
Mainloop–veryfast!
Directwritetovideocache
Ifyoudidcodingandhackedstuffsinthe90’s,you’rea…
SimulateLife
Conway’sGameofLife
JohnConway1970
CellularAutomata–arrayofcells(0or1)
Neighborhood(8cells,sum)
Simpleif-then-elserule
forcellincells:
ifcell==1andsumin[2,3]:cell=1 #surviveelifcell==0andsumin[3]:cell=1 #bornelse:cell=0 #die
cell:0or1
1
0 0
0
1
1
0
0
0
neighborhood
Conway’sGameofLife
Themovingglider
Greencellssurvive,bluecellsareborn,redcellsdie
Spaceships,glidergun…
Logicgate,clock,computer…
Hackersloveit!
Goodwaytolearnprogramming!
Playwiththerules
Whatifwe…
cell:0or1
0
0 0
0
1
0
0
0
0
neighborhood(n)
sum=σ??
cell=(ifsum…then…else…)
Playwiththerules
Whatifwe…
Usefloatingpoint?
realnumber
0.12
0.02 0.00
0.95
0.36
0.17
0.46
0.53
0.22
neighborhood(n)
sum=σ??
cell=(ifsum…then…else…)
Playwiththerules
Whatifwe…
Usefloatingpoint?
Biggerneighborhood?Circular?
realnumber
0.36
neighborhood(n)
sum=σ??
cell=(ifsum…then…else…)
Playwiththerules
Whatifwe…
Usefloatingpoint?
Biggerneighborhood?Circular?
Weightedsum?
realnumber
*
neighborhood(n) weights(k)
sum=σ????
cell=(ifsum…then…else…)
Playwiththerules
realnumber
Whatifwe…
Usefloatingpoint?
Biggerneighborhood?Circular?
Weightedsum?
Smoothupdate?
*
neighborhood(n)
weights(k)
sum=σ????
cell=cell+0.1*f(sum)
Playwiththerules
Whatifwe…
Usefloatingpoint?
Biggerneighborhood?Circular?
Weightedsum?
Smoothupdate?
Spookythingshappened…
OMGWHATISTHIS??
Lenia
NewkindofArtificialLife
Microorganism-likecreatures
Discovered400+species
Studytheiranatomy,behavior,physiology…
Goodprogrammingexercise
JavaScript,C#,MATLAB,Python
Video
Pythonshowcasevideo
/277328815
Kyoto
WonGECCOVirtualCreaturesContest,Kyoto
HonorableMentioninALIFEArtAward,Tokyo
MeetmyAIhero–@hardmaru
DavidHa(GoogleBrainTokyo)
UsingPython
forPyConHK
WhyPython?
Goodperformance
Fastcoding
Nicesyntax(indent,listcomprehension,etc)
Lotsofusefullibraries
Vibrantcommunity(PyCon,GitHub…)
Matplotlib
PythonLibraries
“Rule34”ofPython
NumPy
Arraycalculations
Reikna
PyOpenCL/
PyCUDA
GPU
acceleration
SciPy/
OpenCV
PIL/Pillow
Imageprocessing
Tkinter
InteractiveUI
ffmpeg-python
subprocess+
ffmpeg
Recordvideo
“Ifthereisaneed,thereisaPythonlibraryforit.”
NumPy
Fastarraycalculations
Machinelearning,deeplearning
Basisofimageprocessing,time-series
Cellularautomata(weightedsumusingFFT)
MainloopofLeniain3lines
potential_fft=np.fft.fft2(cells)*kernel_fft
potential=np.fft.fftshift(np.real(np.fft.ifft2(potential_fft))
cells_new=np.clip(cells+dt*g(potential,m,s),0,1)
PyOpenCL/PyCUDA+Reikna
GPUacceleration
(NVIDIA)CUDAPyCUDA
(Apple)OpenCLPyOpenCL
Reikna
PyOpenCL/PyCUDAwrapper
CompilestheGPUcodeforyou
GPUacceleratedFFTinafewlines
gpu_thr=reikna.cluda.any_api().Thread.create()
gpu_fft=reikna.fft.FFT(cells.astype(plex64)).compile(gpu_thr)op_dev=gpu_thr.to_device(cells.astype(plex64))gpu_fft(op_dev,op_dev,**kwargs)
cells=op_dev.get()
PIL/Pillow,SciPy,OpenCV
Imagehandling
PIL(PythonImageLib)pillow
Createimage,drawlines/texts,saveGIF…
img=PIL.Image.frombuffer('P',buffer.shape,buffer,…)
draw=PIL.ImageDraw.Draw(img)
img[0].save(path,format='GIF',append_images=self.gif[1:],loop=0…)
Imageprocessing
SciPy
scipy.ndimage.rotate(A,reshape=False,order=0,mode='wrap’)
OpenCV-Python
TkintervsMatplotlib
InteractiveUI
Real-time2Dimagedisplay
Menu,keyboardbinding,clipboard
Matplotlib
Fordatavisualization
Powerfulbutslow…
Tkinter(Toolkitinterface)
Basicandfast
Others:wxPython,PyQt,PyGTK…
InteractiveUI
win=tk.Tk()tk.Canvas()tk.Menu()
win.bind('<Key>',key_press_event)
win.clipboard_get()
Python3
importtkinterastk
subprocess+ffmpeg
PythonicFFmpegwrappers
ffmpeg-python,ffmpy,etc.
Pipevideotoffmpeg
cmd=['/usr/local/bin/ffmpeg’,'-f','rawvideo',…]
video=subprocess.Popen(cmd,stdin=subprocess.PIPE)forimginimgs:
video.stdin.write(img.convert('RGB').tobytes())video.stdin.close()
AboutALifeandAI
forHKCodeConf
Lenia
Notjustfunnycreatures
UsingAItocreateALife
AboutALife
ArtificialLife
Simulatebiologicallifeorcreatenewlifeforms
Createabody
WetALife=biochemistry,syntheticlife
Artificialcell,expandedgeneticcode…
HardALife=hardware,robots&machines
Humanoids,Strandbeest…
SoftALife=software,simulations
Cellularautomata,virtualcreatures…
WetALife=biochemistry,syntheticlife
Artificialcell,expandedgeneticcode…
HardALife=hardware,robots&machines
Humanoids,Strandbeest…
Syntheticcell(JCVI,2010)
SoftALife=software,simulations
Cellularautomata,virtualcreatures…
ExpandedDNA(TSRI,2014)
WetALife=biochemistry,syntheticlife
Artificialcell,expandedgeneticcode…
HardALife=hardware,robots&machines
Humanoids,Strandbeest…
SoftALife=software,simulations
Cellularautomata,virtualcreatures…
Strandbeest(TheoJansen,1990)
Atlas(BostonDynamics,2017)
SoftALife=software,simulations
Cellularautomata,virtualcreatures…
HardALife=hardware,robots&machines
Humanoids,Strandbeest…
WetALife=biochemistry,syntheticlife
Artificialcell,expandedgeneticcode…
Virtualcreatures(KarlSims,1994)
Softrobots(NickCheney,2014)
AboutAI
EA=EvolutionaryAlgorithms
Neuro-evolution,novelty,etc
ArtificialIntelligence
Machinesdo:learning,planning,vision,language,emotion,art
ML=MachineLearning
Supervised,unsupervised,reinforced
DL=DeepLearning
Deepneuralnets+bigdata+manyGPU
GOFAI=Goodold-fashionedAI
Symbolic,expertsystems
Createamind
GOFAI=Goodold-fashionedAI
Symbolic,expertsystems
ML=MachineLearning
Supervised,unsupervised,reinforced
DL=DeepLearning
Deepneuralnets+bigdata+manyGPU
DeepBluevs.Kasparov(IBM,1997)
EA=EvolutionaryAlgorithms
Neuro-evolution,novelty,etc
WatsoninJeopardy!(IBM,2011)
GOFAI=Goodold-fashionedAI
Symbolic,expertsystems
AlphaGovs.LeeSedol(DeepMind,2016)
ML=MachineLearning
Supervised,unsupervised,reinforced
DL=DeepLearning
Deepneuralnets+bigdata+manyGPU
EA=EvolutionaryAlgorithms
Neuro-evolution,novelty,etc
Autopilot(Tesla,2014)
BigGAN(AndrewBrock,2018)
GOFAI=Goodold-fashionedAI
Symbolic,expertsystems
ML=MachineLearning
Supervised,unsupervised,reinforced
DL=DeepLearning
Deepneuralnets+bigdata+manyGPU
PicBreeder(EPlex,2007)
EA=EvolutionaryAlgorithms
Neuro-evolution,novelty,etc
Evolut
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 智能城市管理與服務(wù)作業(yè)指導(dǎo)書(shū)
- IT領(lǐng)域云服務(wù)平臺(tái)架構(gòu)規(guī)劃與建設(shè)方案
- 軟件測(cè)試技術(shù)及實(shí)施流程作業(yè)指導(dǎo)書(shū)
- 綠色農(nóng)業(yè)發(fā)展作業(yè)指導(dǎo)書(shū)
- 工程居間合同
- 能源化工行業(yè)項(xiàng)目管理作業(yè)指導(dǎo)書(shū)
- 2025年??谪涍\(yùn)從業(yè)資格證年考試題及答案
- 2025年酒泉普通貨運(yùn)從業(yè)資格證考試
- 2024-2025學(xué)年高中地理第四單元從人地關(guān)系看資源與環(huán)境單元活動(dòng)4遙感技術(shù)及其應(yīng)用練習(xí)含解析魯教版必修1
- 景觀設(shè)計(jì)師年終總結(jié)
- 2025年全國(guó)科技活動(dòng)周科普知識(shí)競(jìng)賽試題庫(kù)及答案
- 2025年日歷(日程安排-可直接打印)
- 清華大學(xué)抬頭信紙
- 高中生物必修1思維導(dǎo)圖及部分彩圖
- 新漢語(yǔ)水平考試 HSK(四級(jí))
- 牛津譯林版六年級(jí)下冊(cè)單詞詞匯表匯總(完整打印版)
- JJF 1975-2022 光譜輻射計(jì)校準(zhǔn)規(guī)范
- Q∕SY 05268-2017 油氣管道防雷防靜電與接地技術(shù)規(guī)范
- 財(cái)產(chǎn)保險(xiǎn)招標(biāo)評(píng)分細(xì)則表
- 培卵素是什么
- 《細(xì)菌》初中生物優(yōu)秀教學(xué)設(shè)計(jì)(教案)
評(píng)論
0/150
提交評(píng)論