成果matlab六课教程_第1页
成果matlab六课教程_第2页
成果matlab六课教程_第3页
成果matlab六课教程_第4页
成果matlab六课教程_第5页
已阅读5页,还剩67页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1 1 3IntroductiontoMatlab3IntroductiontoMatlabWhatisaMatlabToolboxesarespecializedcollectionsofMatlabWhydoweneedthe4WhattypeoftoolboxesdoesMatlab4WhattypeoftoolboxesdoesMatlab▪▪ParallelComputing数学、统计与优SymbolicMathPartialDifferentialEquationStatisticsandMachineLearningCurveFittingOptimizationNeuralNetworkModel-BasedCalibrationControlSystemToolboxFuzzyLogicToolboxRobustControlModelPredictiveControlToolboxAerospaceToolboxRoboticsSystem▪▪▪▪▪▪▪5WhattypeoftoolboxesdoesMatlab5WhattypeoftoolboxesdoesMatlab信号处无线DSPSystemToolboxAudioSystemToolboxWaveletToolboxRFToolboxLTESystemToolboxWLANSystem▪▪▪▪▪▪▪▪▪▪图像处理与计算机视ImageProcessingToolboxVisionHDLToolboxMappingToolbox▪▪▪▪▪测试&DataAcquisitionToolboxImageAcquisitionToolboxOPCToolboxVehicleNetwork▪▪▪▪▪6Whattypeoftoolboxesdoes6WhattypeoftoolboxesdoesMatlab计算FinancialDatafeedToolboxDatabaseToolboxSpreadsheetLink(forMicrosoftExcel)FinancialInstrumentsToolbox▪▪▪▪▪▪▪计算生Bioinformatics代码MATLABHDLVisionHDLHDLFilterDesignHDLFixed-Point7Whattypeoftoolboxes7WhattypeoftoolboxesdoesMatlabMATLABMATLABCompilerSpreadsheetLink(forMicrosoftMATLABProductionDatabaseMATLABReportFromDeepLearning8WherecanI8WherecanIfindinformationregarding9ClusteringusingtheStatistics9ClusteringusingtheStatisticsandMachineLearningToolboxTheMatlabStatisticsandMachineLearningToolboxhasmanyStatisticsandDataimportandexport,descriptivestatistics,visualizationProbabilityDistributionsDatafrequencymodels,randomsamplegeneration,parameterestimationHypothesisTestst-test,F-test,chi-squaregoodness-of-fittest,andClusterUnsupervisedlearningtechniquestofindnaturalgroupingsandpatternsinAnalysisofvarianceandcovariance,multivariateANOVA,repeatedmeasuresANOVALinear,generalizedlinear,nonlinear,andnonparametrictechniquesforsupervisedSupervisedlearningalgorithmsforbinaryandmulticlassproblemsDimensionalityReductionPCA,factoranalysis,nonnegativematrixfactorization,sequentialfeatureselection,andmoreIndustrialStatisticsDesignofexperiments(DOE);survivalandreliabilityanalysis;statisticalprocesscontrolSpeedUpStatisticalComputationsParallelordistributedcomputationofstatistical▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪WhatisAWhatisAwaytoform'naturalgroupings'inyourItisaformofunsupervisedlearning–yougenerallydoNOThaveexamplesdemonstratinghowthedatashouldbegroupedWhydoweneedMarketsegmentation:Assistmarketerstoidentifydistinctsub-groupsofcustomersinorderWhydoweneedMarketsegmentation:Assistmarketerstoidentifydistinctsub-groupsofcustomersinordertodeveloptargetedmarketingprogramsGuiltbyassoito”:IdentifyinggroupsofgenesthatbehavesimilarlyunderasetofdifferentexperimentalClusterClusterClusterClustering Clustering K-means K-means K-meansThek-meansalgorithmK-meansThek-meansalgorithmpartitionsthedataintokexclusiveFeatureFeatureK-meansThek-meansalgorithmpartitionsK-meansThek-meansalgorithmpartitionsthedataintokexclusiveK=FeatureFeatureK-meansThek-meansalgorithmpartitionsK-meansThek-meansalgorithmpartitionsthedataintokmutuallyexclusiveK=FeatureFeatureHowdoesitK-meansFormalminimizetotalintra-clusterKd(xjK-meansFormalminimizetotalintra-clusterKd(xj,iSiistheithcluster(i=1,2,...,i1xjµiistheithcentroidofallthepointsinclusterdisadistanceOptimalSuboptimalK-meansIfweknewK-meansIfweknewtheclusterassignmentofeachwecouldeasilycomputethecentroidsIfweknewthecentroidpositionswecouldassigneachpointtoaButwedon’tknowneitherofK-meansAlgorithmChooseK-meansAlgorithmChoosethenumberofclusters,RandomlychooseinitialpositionsofKAssigneachofthepointstothe“nat(dependsondistanceK=K-meansAlgorithmK-meansAlgorithmChoosethenumberofclusters-RandomlychooseinitialpositionsofKAssigneachofthepointstothe“astn”(dependsondistanceK=K-meansAlgorithmChooseK-meansAlgorithmChoosethenumberofclusters-RandomlychooseinitialpositionsofKAssigneachofthepointstothe“artend”ondistancemeasure)CalculatetheintraclusterRe-computecentroidIfsolutionconverges→K=K-meansAlgorithmChooseK-meansAlgorithmChoosethenumberofclusters-RandomlychooseinitialpositionsofKAssigneachofthepointstothe“restetrod”ondistancemeasure)CalculatetheintraclusterRe-computecentroidIfsolutionconverges→K=K-meansAlgorithmChoosethenumberK-meansAlgorithmChoosethenumberofclusters-RandomlychooseinitialpositionsofKcentroidsAssigneachofthepointstothe“restetrod”ondistancemeasure)CalculatetheintraclusterRe-computecentroidpositionsIfsolutionconverges→Stop!K=▪▪▪▪▪▪K-meansAlgorithmChooseK-meansAlgorithmChoosethenumberofclusters-RandomlychooseinitialpositionsofKAssigneachofthepointstothe“restetrod”ondistancemeasure)CalculatetheintraclusterRe-computecentroidIfsolutionconverges→K=K-meansAlgorithmChooseK-meansAlgorithmChoosethenumberofclusters-RandomlychooseinitialpositionsofKAssigneachofthepointstothe“artend”ondistancemeasure)CalculatetheintraclusterRe-computecentroidIfsolution(theintraclustervarianceddnchange)→K=K-means:otherthingsweneedtoHowshouldK-means:otherthingsweneedtoHowshouldwechooseWhattypeofdistancemeasurescanweuse,andhowtochoosebetweenthem?((x2–x1)2+–y1)2)Sumofabsolute|x2–x1|+|y2–1–tAndK-means:otherthingsweneedK-means:otherthingsweneedtoDoesthealgorithmconvergencetoanoptimalCanyouthinkofstrategiesforsolvingBeforewelearnhowtoBeforewelearnhowtodoK-meansinMatlablet’slookatsomerealdata…Inthe1920's,botanistscollectedmeasurementsonsepalsepalpetalpetalof150iris,50fromeachofthreespecies(setosa,versicolor,ThemeasurementsbecameknownasFisher'sirisFisher’sIrisload4Fisher’sIrisload4SampleSampleSampleSample>>1>>'versicolor''virginica','virginica','setosa','setosa','setosa','setosa',FeatureFeatureFeatureFeatureExploringcorrelationsintheExploringcorrelationsintheFisher’sIrisparam_names={'sepallength','sepalwidth','petallength','petaltext([.05.30.55.80],[-0.1,-0.1,-0.1,-0.1],param_names,text([-0.12,-0.12,-0.12,-0.12],[0.800.550.300.05],'FontSize',12,ThepetallengthandwidtharehighlyVisualizingFisher’sIris%76543218276545SepalSepalVisualizingFisher’sIris%76543218276545SepalSepalPetal4K-meansusingDoingK-meansinMatlabis=K-meansusingDoingK-meansinMatlabis=BydefaultkmeansusessquaredEuclidiandistanceTheKTheclusterbelongstoK-meansusingDisplayingthealgorithm=K-meansusingDisplayingthealgorithm=210sumof123441112=K-meansusingClusteringptsymbK-meansusingClusteringptsymb=%Plotclusterpointsfori=1:2clust=(cidx2==i);holdNoticethatclusteringisdonebutvisualization%Plotclustercentroidholdxlabel('SepalLength');ylabel('SepalWidth');zlabel('Petalgridtitle('IrisdataclusteredwithK-meanswhereK=K-meansusingClusteringCluster765Cluster43218276544SepalSepalPetal K-meansusingClusteringCluster765Cluster43218276544SepalSepalPetal K-meansusingClustering765becausetheupperclusterisspreadout,thesethreepointsareclosertothecentroidofthelowerclusteruppercluster43218276544SepalSepalPetal K-meansusingClustering765becausetheupperclusterisspreadout,thesethreepointsareclosertothecentroidofthelowerclusteruppercluster43218276544SepalSepalPetal K-meansusingIncreasingthenumberofK-meansusingIncreasingthenumberof=11112430sumdistances=123455K-meansusingClusteringK-meansusingClusteringfori=clust=(cidx3==i);holdonholdxlabel('SepalLength');ylabel('SepalWidth');zlabel('PetalgridK-meansusingK-meansusingK-meansusingAvoidinglocalminimausingareplicates=4K-meansusingAvoidinglocalminimausingareplicates=458=====K-meansusing76543218276544SepalSepalPetal K-meansusing76543218276544SepalSepalPetal K-meansusing=7Wecanusethecosfunctionasadistancemeasurebetween6543218276544SepalSepalPetal K-meansusing=7Wecanusethecosfunctionasadistancemeasurebetween6543218276544SepalSepalPetal K-meansusingWhichdistancemeasureisK-meansusingWhichdistancemeasureismoreeWeknowthelabelofeachsample.Wecancompareclustersdiscoveredbykmeanstotheactualflowertypes.Note:usuallyinunsupervisedlearningwedoNOTknowthelabelsoftheK-meansusing%TestingtheclusteringaccuracyK-meansusing%Testingtheclusteringaccuracyfori=clust=find(cidx_cos==i);holdonxlabel('Sepalylabel('SepalWidth');gridonmiss=find(cidx_cos===holdK-meansusingCosinebaseddistance:576543218276544SepalPetal K-meansusingCosinebaseddistance:576543218276544SepalPetal K-meansusingEuclideanbaseddistance:1476543218276544SepalSepalPetal K-meansusingEuclideanbaseddistance:1476543218276544SepalSepalPetal HowtochooseWeneedaquantitativemethodtoHowtochooseWeneedaquantitativemethodtoassessthequalityofaThesilhouettevalueofapointisameasureofhowsimilarapointispointsinitsownclustercomparedtopointsinother-Formaldefinition:s(i)max(a(i),istheaveragedistanceofthepointitotheotherpointsinitsownclusterd(i,C)istheaveragedistanceofthepointitotheotherpointsintheclusteristheminimald(i,C)overallclustersotherthanHowtochooseSilhouettevaluesrangesfromHowtochooseSilhouettevaluesrangesfrom-1to→~=objectiswell→~objectisontheborderbetween2→~=-ObjectisclassifiedThesilhouettecoefficientistheaveragesilhouettevalueoverItisaquantitativemeasurethatcanassessthequalityofHowtochooseToHowtochooseTodemonstratetheutilityofthesilhouettecoefficientwecantestitonsyntheticdataforwhichweknowthenumberofx1=randn(1,100);y1=randn(1,scatter(x1,y1,25,[100],holdx2=randn(1,100)+3;y2=randn(1,scatter(x2,y2,25,[010],+x3=randn(1,100)+8;y3=randn(1,100);scatter(x3,y3,25,[001],'filled');holdHowtochooseTodemonstratetheutilityofthesilhouettecoefficientwecantestitonsyntheticdataforwhichweknowthenumberofWeknowthatKis65432100HowtochooseTodemonstratetheutilityofthesilhouettecoefficientwecantestitonsyntheticdataforwhichweknowthenumberofWeknowthatKis654321002468HowtochooseWerunthek-meansalgorithmfordifferentx=[x1,x2,y=[y1,data=[x',K====K=K=6665554443332221110000505 05HowtochooseWerunthek-meansalgorithmfordifferentx=[x1,x2,y=[y1,data=[x',K====K=K=6665554443332221110000505 05Howtochoose>>[silh2,h]=>>1arepoorly201Howtochoose>>[silh2,h]=>>1arepoorly201Howtochoose>>[silh3,h]>>12301SilhouetteHowtochoose>>[silh3,h]>>12301SilhouetteHowtochoose>>[silh4,h]>>12340SilhouetteHowtochoose>>[silh4,h]>>12340Silhouette1HowtochooseOptimalSilhouettevalueisachievedwhenK=32345K6HowtochooseOptimalSilhouettevalueisachievedwhenK=32345K678MeansilhouetteK-means investigateK-means investigategroupinginyourdata,simultaneouslyoveravarietyofscalesAlgorithm1)DeterminethedistancebetweenAlgorithm1)DeterminethedistancebetweeneachpairofdifferentTypesofdistances(Euclidean,correlation,1234512345Algorithm1)DeterminethedistancebetweeneachpairAlgorithm1)Determinethedistancebetweeneachpairof2)IterativelygrouppointsintoabinaryhierarchicaltreeConnecttheclosestpairofpointsandre-computedistance9876Thedistanceatwhichthepairofpointswere34521Algorithm1)DeterminethedistancebetweeneachpairofAlgorithm1)Determinethedistancebetweeneachpairof2)Iterativelygrouppointsintoabinaryhierarchicaltree3)Cutthehierarchicaltreeinto34521Hierarchicalclustering,otherthingsweHierarchicalclustering,otherthingswetoTypesofSinglelinkageiorDistancebetweengroupsisdefinedasthebetweentheclosestpairofpointsfromeachHierarchicalclustering,otherthingsweHierarchicalclustering,otherthingswetoTypesofCompletelinkageibDistancebetweengroupsisdefinedasthedistancebetweenthemostdistantpairofpointsfromtwoHierarchicalclustering,otherHierarchicalclustering,otherthingsweneedtoconsiderTypesofAveragelinkageclustering:Thedistancebetweentwoclustersisdefinedastheaverageofdistancesbetweenallpairsofpoints(ofoppositeHierarchicalclustering,otherthingswetoHierarchicalclustering,otherthingswetoWheretocuttheCuttingatanarbitraryHierarchicalclustering,otherthingsweneedtoconsiderWheretocuttheHierarchicalclustering,otherthingsweneedtoconsiderWheretocutthe▪▪CuttingatanarbitraryCuttingatinconsistencyComparetheheightofeachlinkinthetreewiththeheightsoflinksbelowit:IfapproximatelyequalThislinkexhibitsahighlevelofconsistency.Therearenodistinctdivisionsbetweentheobjectsjoinedatthislevelofthehierarchy.▪IfheightsdifferThislinkissaidtobeinconsistentinrespecttothelinksbelowit.Thisindicatestheborderofanaturaldivisioninadataset.Forformaldefinitionsseetoolbox▪▪HierarchicalclusteringusingLoadtheIris>>HierarchicalclusteringusingLoadtheIris>>load1)Computethedistancesbetweeneach>>euc

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论