深度學(xué)習(xí)-用 PYTHON 開發(fā)你的智能應(yīng)用_第1頁
深度學(xué)習(xí)-用 PYTHON 開發(fā)你的智能應(yīng)用_第2頁
深度學(xué)習(xí)-用 PYTHON 開發(fā)你的智能應(yīng)用_第3頁
深度學(xué)習(xí)-用 PYTHON 開發(fā)你的智能應(yīng)用_第4頁
深度學(xué)習(xí)-用 PYTHON 開發(fā)你的智能應(yīng)用_第5頁
已閱讀5頁,還剩43頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

深度學(xué)習(xí)

一用PYTHON開發(fā)你的智能應(yīng)用

費良宏

21April2016

關(guān)于我

?工作:AmazonWebServices/Evangelist

■7年Windows/Internet/Cloud@Microsoh

■3年iOS/MobileApp@Apple

■1.5年CloudComputing@AWS

?技術(shù)關(guān)注:

■云計算:架構(gòu)、大數(shù)據(jù)、計算優(yōu)化

?機器學(xué)習(xí):深度學(xué)習(xí)、自然語言處理

■語言:Python、Go、Scala、Lua

■Web:爬蟲

?2016的目標(biāo):Web爬蟲+深度學(xué)習(xí)+自然語言處理=?

今年最激動人心的事件?

MasteringtheGameofGowithDeepNeuralNetworksand

TreeSearch

DavidSilver1?.AjaHUM(1?.Cl??JKUAfae.ArtbarGuezJ.S-fte1.Geon**dee

OwtuW.JulumSchnttwietcr.iMMitAMCttofku*.VWiPaaaemhcH?LMOM*.

Dtekmair.DOBMHGfe?e'.JohnNhan1,NdKakhtramr1.防“Suutever3.nmrthx

I川KT?plMalektaeUartlKcnyjgcwfluLIVxeGrt^l1.DemtoHimbi.1.

1G”kDccpMind.5SmdSquitc.U*loaEC4AXTW

aGoofk.1600AgnhirrPwi”).MediumViewCAMM3.

?Theyjuthonc?NitnhuMdct^uallyioOutwort

CcrretpiNMlcfKCshouldbealdre4f?dtoeitherDavidSihw(dv?d“1v?t.foof>ecan)orDemis

(dtffnithaMabiiernoflccamX

TheeamroCGohMto—beenviewedmthernotfdktttlng<fctw^cCMM?forar-

iatdHcwrd?cIoIUmonncmtMwchtpeceandthedtfbewhyof?valMtincboard

pmitkNMandtn^eWcialrodoce.oewapprowlitoc?np^erG<UnannrivrMffwrfti

tonafauiuboardporitiomandiwfwrifto?<h<1nw?EThtwtdeepmralnetworki

arvtrainedby.notelcombination<i(wpenbedkArntocfrwnhwaoptrtgMim.and

rvinfommriitkarninsfromsametottetf-ptey.WithoetanylooUlMMiteardutheantrai

nrtworksph,G?attbck**iMsUte^ClhrSM<Mte-C?riotreeiraxhprocraoBthatUm?

ulalrthomaiMfe“randomc^ncsofMtf-pto).We3intnxhictanewMarchalgodlhm

gcombtooMoote<?%UrnuUtionwithvalueandpolicynctvorUIM*5*mrch*

gorUua.<NirprofnuDAtpkaGcachioeda”4■TnalncrateS*otherG?prvcrMm.

anddefeatedtheEuropeanachampioaby5camttCo0.Thktett?Et**?c<?-

piHtrprognunluudefeated▲hatnanprvfmloMlplayerinthefwIMttdgaoKofGc,a(eM

prr%i<>a$h(hoaghttoheatkaUadecMk■■?,.

Allgames“peHectmfocmMioahaveanopeuno/voterjfanctkNi,,(?),**>ch

thecukocneofthegame.fromeveryboardpovoottor?aifdunderE"pi?y》allphycn

IhevpmcmaybewivedbyrecursivelycocnpuCiaf(beopdnn]vihiefusoam?Jtbtree

00ngingapproximatelyMpcxtiblevqueocetofmovei.whereb松(htbrwdA<number

2016.1.28"MasteringthegameofGowithdeepneuralnetworksandtreesearch”

人工智能VS.機器學(xué)習(xí)VS,深度學(xué)習(xí)

SubjectivePopularity

I

9

6

0

1

9

6

5

g

7

0A

Wc

en

r

bn

oa

1s

95-m

7a

5a

?H

N7

e0

u

r

a

-

N喀

e

t

w

oJ

r.

k?

sQ

E黑

Rn

至ul

a

5nn

D

e

c

-

s

lon-v南

Te

er

g_;

6O

3C

X等

S

5

S?s-H

Sco

hc

mhr

2K國

0heK

ue

0br

。e

r*

£.出

?B

2r

0e

0A-m

5dRa

aan

Bn

Od

Oo

AUuTEm

&Cn5

ug5

?n53

N?

2

2

5

四大宗師

YannLecun,GeoffHinton,YoshuaBengio,AndrewNg

機器學(xué)習(xí)

機器學(xué)習(xí)是一門人工智能的科學(xué)。機器學(xué)習(xí)算法是一類從

數(shù)據(jù)中自動分析獲得規(guī)律,并利用規(guī)律對未知數(shù)據(jù)進行預(yù)

測的算法

機器學(xué)習(xí)

計算機能夠分辨出來他/她是誰嗎?

機器學(xué)習(xí)

機器學(xué)習(xí)

?基于過去的事實和數(shù)據(jù),用來發(fā)現(xiàn)趨勢和模式

?機器學(xué)習(xí)模型提供了對于結(jié)果的洞察力,機器學(xué)習(xí)幫助

揭示未來的一個結(jié)果的概率而不僅僅是過去發(fā)生的事情

?歷史的數(shù)據(jù)和統(tǒng)計建模被用于概率進行預(yù)測

傳統(tǒng)的數(shù)據(jù)分析旨在回答關(guān)于過去的事實,機器學(xué)習(xí)的目

的是回答關(guān)于未來事件的可能性的問題/

機器學(xué)習(xí)的應(yīng)用場景

個性化-提供個性化的電子商務(wù)體驗

文檔聚類-按照文檔上下文自動分類

欺詐檢測-發(fā)現(xiàn)異常的規(guī)律行為,識別和標(biāo)記欺詐交易

推薦引擎

客戶流失預(yù)測

機器學(xué)習(xí)一學(xué)習(xí)方式

?監(jiān)督學(xué)習(xí)-人工干預(yù)和驗證的要求,算法:LogisticRegression,BackPropagationNeural

Network等。例如:照片分類和標(biāo)簽

?無監(jiān)督學(xué)習(xí)-無人工干預(yù)的要求,算法:Apriori算法以及k-Means。例如:對于文當(dāng)?shù)幕谏舷?/p>

文的自動分類

?半監(jiān)督學(xué)習(xí).介于監(jiān)督學(xué)習(xí)和無監(jiān)督學(xué)習(xí)之間,算法:GraphInference或者LaplacianSVM

?強化學(xué)習(xí)-通過觀察來學(xué)習(xí)做成如何的動作,算法:Q-Leaming以及時間差學(xué)習(xí)

kja-l/風(fēng).上&孫產(chǎn),七旬

f,

y”…人以山“"j3外=竹.)

心,=*Ai豈

3?N⑸㈤6vxM,"卷L

己二mis久4”S=觸一

機器學(xué)習(xí)一方法及流程

?輸入特征選擇-基于什么進行預(yù)測

?目標(biāo)-預(yù)測什么

?預(yù)測功能-回歸、聚類、降維…

Xn->F(xn)->T(x)

機器學(xué)習(xí)-舉例

0.5

0.45

Lj0.4

/n6F(xn);Target:y

0.35

ESIE9IEsaY0.3

0.31

0.25

0.140.170.20.30.20

0.240.210.190.150.3510.2

0.30.250.350.40.4510.15

0.1

0.05

0

012345

X1■X2A-X3xX4*X5

機器學(xué)習(xí)一舉例

?如何讓機器分辨出來他/她是誰?

?圖像分析-

輸入特征選擇。面部特征、發(fā)型、裙子、身高、手勢…

機器學(xué)習(xí)一何時使用

你不需要機器學(xué)習(xí),如果-

?使用簡單的規(guī)則和計算,你可以預(yù)測答案

?你能夠預(yù)先了解到所需要的步驟不需要任何數(shù)據(jù)驅(qū)動的

學(xué)習(xí)

你需要機器學(xué)習(xí),如果-

?簡單的聚類規(guī)則是不充分的

?面對大量的數(shù)據(jù)集的可伸縮性的問題

機器學(xué)習(xí)一總結(jié)

由已知答案的數(shù)據(jù)開始

明確目標(biāo)-從數(shù)據(jù)中希望可以預(yù)測什么

選擇可以被用來預(yù)測目標(biāo)的模式所需要的變量/特性

使用已知目標(biāo)答案的數(shù)據(jù)訓(xùn)練機器學(xué)習(xí)模型

對于未知答案的數(shù)據(jù),使用訓(xùn)練過的模型預(yù)測目標(biāo)

評估模型的準(zhǔn)確性

提高模型精度

什么是深度學(xué)習(xí)?

“深度學(xué)習(xí)是機器學(xué)習(xí)的一個分支,是一組在多個層次上

學(xué)習(xí)的算法,分別對應(yīng)不同級別的抽象,

*

深度學(xué)習(xí)VS.機器學(xué)習(xí)

?ML的算法包括監(jiān)督學(xué)習(xí)和無監(jiān)督學(xué)習(xí)

?適用非線性處理單元的多層次的特征提取和轉(zhuǎn)換

?基于對多個層的特征或者表象的學(xué)習(xí),形成一個由低級

到高級的層次結(jié)構(gòu)特征

傳統(tǒng)的機器學(xué)習(xí)關(guān)注于特征工程,深度學(xué)習(xí)關(guān)注于端到

端的基于原始數(shù)據(jù)的學(xué)習(xí)

為什么需要深度學(xué)習(xí)?

DeepLearning:Why?

/zlVeWOKQHallkvtyLl-fet

Machii/ve-。小1伙),auvdizve

kvex/^rs"uvokvealgorLthuvtfeuvocfe

overbekvchkvt?rtesiXfeeAc叩

—aKi/viuvg”

—AndrewNg

深度學(xué)習(xí)?舉例

目標(biāo):熊

位置:黃石公M

動作:覓食

f目標(biāo)鷹

位的佛羅里達

4加上動作

目標(biāo):多個-人、球

?位置:蒙大拿

動作:玩耍

目標(biāo):?

位置:蒙大拿

動作:?

深度學(xué)習(xí)一神經(jīng)網(wǎng)絡(luò)

是一種模仿生物神經(jīng)網(wǎng)絡(luò)(例如大腦)的結(jié)構(gòu)和功能的計

算模型

是一種非線性統(tǒng)計性數(shù)據(jù)建模工具,對輸入和輸出間復(fù)

雜的關(guān)系進行建模

一組簡單可以訓(xùn)練的數(shù)學(xué)單元集合,共同學(xué)習(xí)復(fù)雜的功

0

8

8

神經(jīng)網(wǎng)絡(luò)

深度學(xué)習(xí)一訓(xùn)練

深度學(xué)習(xí)一部署

O0

0

O0

0

C0

0

60

0

00

*

神經(jīng)網(wǎng)絡(luò)

深度學(xué)習(xí)一數(shù)據(jù)表現(xiàn)

?表現(xiàn)層次

?圖片-像素、主題、部分、輪廓、邊緣等等

?視頻-圖像幀、每幀的像素、每一幀的deltas值等等

?文本-字符、詞、從句、句子等等

?語音-音頻、頻段、波長、調(diào)制等等

深度學(xué)習(xí)的優(yōu)勢

?特性自動推導(dǎo)和預(yù)期結(jié)果的優(yōu)化調(diào)整

?可變的自動學(xué)習(xí)的健壯性

?重用性一相同的神經(jīng)網(wǎng)絡(luò)的方法可用于許多應(yīng)用和數(shù)據(jù)

類型

■通過利用GPU的大規(guī)模并行計算.可擴展的大容量數(shù)據(jù)

深度學(xué)習(xí)的開發(fā)框架

?Torch(NYU,2002),FacebookAl,GoogleDeepmind

?Theano(UniversityofMontreal,"2010),學(xué)院派

?Kersa/'DeepLearninglibraryforTheanoandTensorFlow,,

?Caffe(Berkeley),卷積神經(jīng)網(wǎng)絡(luò),賈揚清

?TensorFlow(Google)

?SparkMLLib

深度學(xué)習(xí)中的開發(fā)框架框架

pythonhasawiderangeofdeeplearning-related

librariesavailable

andofcourse:

Highlevel(theano-extension,modelsinpythoncode,

theanonothidden)

(theano-wrapper,modelsinpythoncode,

abstractstheanoaway)

Pylearn2(wrapperfortheano,yaml,experiment-oriented)

(computer-visionorientedDLframework,

model-zoo,prototxtmodeldefinitions)

Caffepythonificationongoing!

Lowlevelheano(efficientgpu-poweredmath)

?學(xué)院派血統(tǒng),MontrealUniversity

?非常靈活,非常復(fù)雜

?通過底層借口可以做到大量的定制

?衍生了大量的豐富的項目Keras,PyLearn2,Lasagne...

?PythonicAPI,非常好的文檔

Welcome

TheanoisaPythonlibrarythatallowsyoutodefine,optimize,andevaluatemathematicalexpressionsnvobingmulU-dimensionalarraysefficiently.Theanofeatures

?tightintegrationwithNumPy-Usenu^y.ndarrayinTheano-compiledfunctions.

?transparentuseofaCPU-Performdata-intensiveCAlcuUtionsupto140xfasterthanwithCPUXBoatB?only)

?efficientsymbolicdifferentiation-Theanodoesyourderivativesforfunctionwithoneormanyinpixs.

?speedandsubihtyoptimizationsGettherightanswerforloc(l?x)evenwhenxi$rejJJytiny.

?dynamicCcodegeneration-EvaRnteexpressionsfaster.

?extensiveunit-testingandself-v<rifk4itk>n-Detectanddiagnosemanytypesoferrors.

Theanohasbeenpoweringlar^e-scalecompuUtiooalhfintensiveuientifkinvesgMiomsince2007.BjtitisalsoApproachableenoughtobeusedinth*daisroom

(UniversityofMontreal's/mxhmvMannQclasses).

News

?Theano0.8wasreleased21thMarch2016.Eerybod^isencouragedtoupdate.

?Multi-CPU.

?WeaddedsupportforCuQNNn.

?WeaddedsupportforCMReMtospeeluptheCPUmemoryallocation.

?Theano0.7wasreleased26thMarch201S.Everybodyisencouragedtoupdate.

?Wesupport心二、IfItKInstalledtvtKuser.

?OpenMachinelearningWorkshop2914

?ColinRaffelutofiaonTheano.

?UrnCoodfclk)wdida[2h《;?】,*、、?n?:-cnThc.inp.

?Newtechnicalreport8Theano:Derate、k//一J.o一

??門31.WeincludedaftwfixesdiscoveredRegtheTutorial.

THEANO實踐

1importtheano

2frortheanoimporttensorasTimports

3

4a三T.scalar()

b=T.theanosymbolicvariableinitialization

6

7y二a丁bIourmodel

9multiply,theano.function(inp」ts-[a,b],outputs-y)|compilingtoapythonfunction

10

11printmultiply。,2)#2

12printmultiply?,3)#9Usage

13

THEANO實踐

importtheano

2imports

3theanoimporttensorasI

importnumpyasnp

5

6np.linspace(-1,1,101)

2*trX+np.random.randn(*trX.sh叩e)*0.33traningdatageneration

8X

9YT.scaiar()

T.scalar()symbolicvariableinitialization

11defmodel(X,w):

12returnX*wourmodel

14wtheano.shared(np.asar「ay(D.,dtypetheano.config.f:oatX))|modelparameterinitialization

15y=model(X,w)

16

17cost=T?mean(T.sqr(y-Y))一metrictobeoptimizedbymodel

18gradientT.grad(costcost,wrtw)learningsignalforparameter(s)

updates[[w?w-gradient*0.01]]howtochangeparameterbasedonlearningsignal

20___________________________________

21traintheano.function(inputs=[X,Y],outputscost,updatesupdates,allowinputdowncast=True)

22compilingtoapythonfunction

23foriinrange(100):

24forx,yinzip(trX,trY):iteratethroughdata100timesandtrainmodel

25train(x,y)oneachexampleofinput,outputpairs

26

THEANO中的卷積極神經(jīng)網(wǎng)絡(luò)

ttheano

theanoimporttensorimports

numpyasnp

5

6np.linspace(-1,1,101)

2*trX+np.random.randn(*trX.sh叩e)*0.33traningdatageneration

8X

9YT.scaiar()

T.scalar()symbolicvariableinitialization

11defmodel(X,w):

12returnX*wourmodel

T3-

14wtheano.shared(np.asar「ay(D.,dtypetheano.config.floatX))modelparameterinitialization

15y=model(X,w)

16

17cost=T?mean(T.sqr(y-Y))一metrictobeoptimizedbymodel

18gradientT.grad(costcost,wrtw)learningsignalforparameter(s)

19updates[[w?wgradient*0.01]]howtochangeparameterbasedonlearningsignal

20___________________________________

21traintheano.function(inputs=[X,Y],outputscost,updatesupdates,allowinputdowncast=True)

22____________compilingtoapythonfunction

23foriinrange(100):

24forx,ymzip(trX,trY):iteratethroughdata100timesandtrainmodel

25train(x,y)oneachexampleofinput,outputpairs

76

為什么是PYTHON?

最好的“膠水”代碼用于研究、快速開發(fā)

iPython,數(shù)據(jù)可視化

豐富的框架資源Theano,Kersa,TensorFlow

海量的社區(qū)、開源的支持

為什么需要GPU?

Hardware⑸2

AnearlyversionofAlphaGowastestedonhardwarewithvariousnumbersofCPUsandGPUs,runninginasynchronousordistributedmode,

ratingsarelistedbelow.問inthematcheswithmoretimepermovehigherratingsareachieved.

Configurationandperformance

Configuration,Search.No.OfCPU-No.OfGPU.Elorating-

threads”

Single⑹P-10-11404812,151

Single404822,738

Single404842,850

Single404882,890

Distributed12428642,937

Dislributed247641123,079

Dislributed401.2021763,140

Distributed641,9202803,168

為什么需要GPU?

?CPU-指令并行執(zhí)行,數(shù)據(jù)并行運算

?GPU-矩陣類型的數(shù)值計算,尤其浮點運算

GPU

建立自己的深度學(xué)習(xí)的應(yīng)用環(huán)境

適用于深度學(xué)習(xí)的AWSG2實例-

?4個NVIDIAGRIDGPUs,每1個包括了1,536CUDAcorestU

及4GBofvideo

?32vCPUs

?60GB內(nèi)存

?240GB(2x120)ofSSD存儲

1.ChooseAWl2.ChooMInstanooiyp?3.Configuremstanoe4AridStorage5,TagInstance6ConfigureSecurityGroup7.Review

Step2:ChooseanInstanceType

AmazonEC2providesawideselectionofinstancetypesoptimizBdtofitdifferentusecases.Instancesarevirtualserversthatcanfunapplications.TheyhavevaryingcombinationsofCPU.memory,stoi

foryourappications.Leammoreatx)utinstancetypesandhowtheycanmeetyourcomputingneeds.

Alterby:GPUinstances▼Currentgeneration▼Show/HideColumns

Currentlyselected:g2.8xlarge(104ECUs.32vCPUs,2.6GHz.IntelXeonE5-2670.60GiBmemory,2x120GiBStorageCapacity)

Note:Thevendorrecommendsusingag2.2xlargeinstance(oflarger)forthebestexperiencewiththisproduct.

Family▼vCPUs①▼Memory(GiB)hstancoStorage(GB)(l)

GPUinstancesgZZxlarge8151x60(SSD)

■GPUinstancesg2.8xlarge32602x120(SSD)

Step1:ChooseanAmazonMachineImage(AMI)CancelandExit

AnAMIisalemptetethatcontainsthesoftwareconfiguration(operatingsysterr.appmatdserver,andapplications)requredtolaunchyourhstance.\bucanselectaAMIprovidedbyAWS.ourusarconynunffy.crtheAWSMarketplace;or

youcanselectoneofyourownAMls.

Ou?ckStart1to21or21Products

QW

MyAMtt

AmazonUnuxAMINVIDIAGRIDGPUDrwor

AWSMarkgace

*****(11)120168?M|SoPRNVWCowaloe

CommunityAMlstaoatrlor?onwar??AWSuMQefMa

L*M*0>^AmaronUrM(20*(niM^Ar??nMKrtrwtTUQ?lM^|Up<lMea312aM6

▼CathodesIhoAmazonUnixAMIisasupporlodandmafitanodUruximagoprowledbyAmnonWobSorvtoesforusoonAmazonBasbcCooputeCloud(AmazonECS).hprovidesa

stabta....

AllSteoctM

ProducttvghftgMs:

Softwarelr*8stfucture(19)

AWShtegrabon-TheZmazonLinuxAMi2MdMpackagesandconfiguraliomthatprovide?ghtintegrationwithAmazonWebServiom

Bu&nessScnware(9)SecureConfiguration-Theccr^guraitonoftheAmazonLinuxAMIonhance?oecurtybyfocusngontwomainsecurityQoals:firrrtngaccessandreducingsdtwaro

vuHorabiibos.

▼OperatinflS^wtemPackageRepositoryAozoss?Th?An^azonUnuxAMiM<te*gn?dtobeuMdnoo^urxtdwRhoriirwpackagaropcsncriMho610dneochAmazonEC2r?Qon.

grM

TheAmazonUnuxAMIisasupportodar>dmantar>odLirx?imagoprovidedbyAmizonWot>SorvtoosforUMonAmazonBasteQxrput?CkxjdlAmazonUprovKJoaa

sUbte.Mcur*.and(?donnarc?cxeoubor?rWfonnwMforthe的D(AGRIDGPUDrtvrAMIwtKhallowsappftcabondovotoponitorunNVIDIAGoForcx>>optmaed

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論