matlab-mnist-two-layer-perceptron

我要开发同款
匿名用户2021年11月17日
172阅读

技术信息

授权协议
Readme

作品详情

RecogizigHadwritteDigitsusigaTwo-layerPerceptro

Thisrepositorycotaiscodecorrespodigtothesemiarpaper:

D.Stutz.ItroductiotoNeuralNetworks.SemiarReport,HumaLaguageTechologyadPatterRecogitioGroup,RWTHAacheUiversity,2014.

Advisor:PavelGolik

Update:Thecodecabeadaptedtoallowmii-batchtraiigasdoeithisfork.

MNISTDataset

TheMNISTdatasetprovidesatraiigsetof60,000hadwrittedigitsadavalidatiosetof10,000hadwrittedigits.Theimageshavesize28x28pixels.Therefore,wheusigatwo-layerperceptro,weeed28x28=784iputuitsad10outputuits(represetigthe10differetdigits).

ThemethodsloadMNISTImagesadloadMNISTLaelsareusedtoloadtheMNISTdatasetasitisstorediaspecialfileformat.Themethodscabefoudolieathttps://ufldl.staford.edu/wiki/idex.php/Usig_the_MNIST_Dataset.

MethodsadUsage

Themaimethodtotraithetwo-layerperceptroistraiStochasticSquaredErrorTwoLayerPerceptro.Themethodappliesstochastictraiig(ortobepreciseastochasticvariatofmii-batchtraiig)usigthesum-of-squarederrorfuctioadtheerrorbackpropagatioalgorithm.

fuctio[hiddeWeights,outputWeights,error]=traiStochasticSquaredErrorTwoLayerPerceptro(activatioFuctio,dActivatioFuctio,umberOfHiddeUits,iputValues,targetValues,epochs,batchSize,learigRate)%traiStochasticSquaredErrorTwoLayerPerceptroCreatesatwo-layerperceptro%adtraisitotheMNISTdataset.%%INPUT:%activatioFuctio:Activatiofuctiousedibothlayers.%dActivatioFuctio:Derivativeoftheactivatio%fuctiousedibothlayers.%umberOfHiddeUits:Numberofhiddeuits.%iputValues:Iputvaluesfortraiig(784x60000)%targetValues:Targetvaluesfortraiig(1x60000)%epochs:Numberofepochstotrai.%batchSize:PloterrorafterbatchSizeimages.%learigRate:Learigratetoapply.%%OUTPUT:%hiddeWeights:Weightsofthehiddelayer.%outputWeights:Weightsoftheoutputlayer.%

Theabovemethodrequirestheactivatiofuctiousedforboththehiddeadtheoutputlayertobegiveasparameter.Iusedthelogisticsigmoidactivatiofuctio:

fuctioy=logisticSigmoid(x)%simpleLogisticSigmoidLogisticsigmoidactivatiofuctio%%INPUT:%x:Iputvector.%%OUTPUT:%y:Outputvectorwherethelogisticsigmoidwasappliedelemetby%elemet.%

Iadditio,theerrorbackpropagatioalgorithmeedsthederivativeoftheusedactivatiofuctio:

fuctioy=dLogisticSigmoid(x)%dLogisticSigmoidDerivativeofthelogisticsigmoid.%%INPUT:%x:Iputvector.%%OUTPUT:%y:Outputvectorwherethederivativeofthelogisticsigmoidwas%appliedelemetbyelemet.%

ThemethodapplyStochasticSquaredErrorTwoLayerPerceptroMNISTusesboththetraiigmethodseeaboveadthemethodvalidateTwoLayerPerceptrotoevaluatetheperformaceofthetwo-layerperceptro:

fuctio[correctlyClassified,classificatioErrors]=validateTwoLayerPerceptro(activatioFuctio,hiddeWeights,outputWeights,iputValues,labels)%validateTwoLayerPerceptroValidatethetwolayerperceptrousigthe%validatioset.%%INPUT:%activatioFuctio:Activatiofuctiousedibothlayers.%hiddeWeights:Weightsofthehiddelayer.%outputWeights:Weightsoftheoutputlayer.%iputValues:Iputvaluesfortraiig(784x10000).%labels:Labelsforvalidatio(1x10000).%%OUTPUT:%correctlyClassified:Numberofcorrectlyclassifiedvalues.%classificatioErrors:Numberofclassificatioerrors.%Licese

Liceseforsourcecodecorrespodigto:

D.Stutz.ItroductiotoNeuralNetworks.SemiarReport,HumaLaguageTechologyadPatterRecogitioGroup,RWTHAacheUiversity,2014.

Copyright(c)2014-2018DavidStutz

Pleasereadcarefullythefollowigtermsadcoditiosadayaccompayigdocumetatiobeforeyoudowloadad/orusethissoftwareadassociateddocumetatiofiles(the"Software").

Theauthorsherebygratyouao-exclusive,o-trasferable,freeofchargerighttocopy,modify,merge,publish,distribute,adsublicesetheSoftwareforthesolepurposeofperformigo-commercialscietificresearch,o-commercialeducatio,oro-commercialartisticprojects.

Ayotheruse,iparticularayuseforcommercialpurposes,isprohibited.Thisicludes,withoutlimitatio,icorporatioiacommercialproduct,useiacommercialservice,orproductioofotherartefactsforcommercialpurposes.

THESOFTWAREISPROVIDED"ASIS",WITHOUTWARRANTYOFANYKIND,EXPRESSORIMPLIED,INCLUDINGBUTNOTLIMITEDTOTHEWARRANTIESOFMERCHANTABILITY,FITNESSFORAPARTICULARPURPOSEANDNONINFRINGEMENT.INNOEVENTSHALLTHEAUTHORSORCOPYRIGHTHOLDERSBELIABLEFORANYCLAIM,DAMAGESOROTHERLIABILITY,WHETHERINANACTIONOFCONTRACT,TORTOROTHERWISE,ARISINGFROM,OUTOFORINCONNECTIONWITHTHESOFTWAREORTHEUSEOROTHERDEALINGSINTHESOFTWARE.

Youuderstadadagreethattheauthorsareuderoobligatiotoprovideeithermaiteaceservices,updateservices,oticesoflatetdefects,orcorrectiosofdefectswithregardtotheSoftware.Theauthorseverthelessreservetherighttoupdate,modify,ordiscotiuetheSoftwareataytime.

TheabovecopyrightoticeadthispermissiooticeshallbeicludediallcopiesorsubstatialportiosoftheSoftware.Youagreetocitethecorrespodigpapers(seeabove)idocumetsadpapersthatreportoresearchusigtheSoftware.

功能介绍

Recognizing Handwritten Digits using a Two-layer Perceptron This repository contains code corresp...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论