模式分类matlab实现

  • n3_211929
    了解作者
  • 543.6KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-13 01:16
    上传日期
duda给出的模式分类一书的matlab实现.
Computer+Manual+in+MATLAB+to+Accompany+Pattern+Classification%2C+2nd+Edition.rar
  • Computer+Manual+in+MATLAB+to+Accompany+Pattern+Classification%2C+2nd+Edition.pdf
    1021.4KB
内容介绍
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8"> <meta name="generator" content="pdf2htmlEX"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css"> <link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css"> <link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/627d43579b6e2b6d551fec86/raw.css"> <script src="https://static.pudn.com/base/js/compatibility.min.js"></script> <script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script> <script> try{ pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({}); }catch(e){} </script> <title></title> </head> <body> <div id="sidebar" style="display: none"> <div id="outline"> </div> </div> <div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/627d43579b6e2b6d551fec86/bg1.jpg"><div class="t m0 x1 h2 y1 ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc1">while</span>(dW &gt; 1e-15),</div><div class="t m0 x1 h2 y2 ff1 fs0 fc1 sc0 ls0 ws0"> <span class="fc2">%Choose a sample randomly</span></div><div class="t m0 x1 h2 y3 ff1 fs0 fc1 sc0 ls0 ws0"> <span class="fc0">i = randperm(L);</span></div><div class="t m0 x1 h2 y4 ff1 fs0 fc0 sc0 ls0 ws0"> phi = train_features(:,i(1));</div><div class="t m0 x1 h2 y5 ff1 fs0 fc0 sc0 ls0 ws0"> net_k = W'*phi;</div><div class="t m0 x1 h2 y6 ff1 fs0 fc0 sc0 ls0 ws0"> y_star= find(net_k == max(net_k));</div><div class="t m0 x1 h2 y7 ff1 fs0 fc0 sc0 ls0 ws0"> y_star= y_star(1);</div><div class="t m0 x1 h2 y8 ff1 fs0 fc2 sc0 ls0 ws0"> %Just in case two have the same weights!</div><div class="t m0 x1 h2 y9 ff1 fs0 fc0 sc0 ls0 ws0"> oldW = W;</div><div class="t m0 x1 h2 ya ff1 fs0 fc0 sc0 ls0 ws0"> W = W + eta*phi*gamma(win_width*abs(net<span class="fc6 sc0">_k - y_star))';</span></div><div class="t m0 x1 h2 yb ff1 fs0 fc0 sc0 ls0 ws0"> W = W ./ (ones(D,1)*sqrt(sum(W.^2)));</div><div class="t m0 x1 h2 yc ff1 fs0 fc0 sc0 ls0 ws0"> eta = eta * deta;</div><div class="t m0 x1 h2 yd ff1 fs0 fc0 sc0 ls0 ws0"> dW = sum(sum(abs(oldW-W)));</div><div class="t m0 x1 h2 ye ff1 fs0 fc0 sc0 ls0 ws0"> iter = iter + 1; </div><div class="t m0 x2 h3 yf ff2 fs1 fc1 sc0 ls0 ws0"> </div><div class="t m0 x1 h2 y10 ff1 fs0 fc1 sc0 ls0 ws0">if<span class="fc0"> (plot_on == 1),</span></div><div class="t m0 x1 h2 y11 ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc2">%Assign each of the features to a cen<span class="fc6 sc0">ter</span></span></div><div class="t m0 x1 h2 y12 ff1 fs0 fc0 sc0 ls0 ws0"> dist = W'*train_features;</div><div class="t m0 x1 h2 y13 ff1 fs0 fc0 sc0 ls0 ws0"> [m, label] = max(dist);</div><div class="t m0 x1 h2 y14 ff1 fs0 fc0 sc0 ls0 ws0"> centers = zeros(D,Nmu);</div><div class="t m0 x1 h2 y15 ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc3"> <span class="fc1">for </span></span>i = 1:Nmu,</div><div class="t m0 x1 h2 y16 ff1 fs0 fc0 sc0 ls0 ws0"> in = find(label == i);</div><div class="t m0 x1 h2 y17 ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc1">if</span> ~isempty(in)</div><div class="t m0 x1 h2 y18 ff1 fs0 fc0 sc0 ls0 ws0"> centers(:,i) = mean(trai<span class="fc6 sc0">n_</span>featu<span class="fc6 sc0">res(:,find(label==i))')';</span></div><div class="t m0 x1 h2 y19 ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc1">else</span></div><div class="t m0 x1 h2 y1a ff1 fs0 fc0 sc0 ls0 ws0"> centers(:,i) = nan;</div><div class="t m0 x1 h2 y1b ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc1">end</span></div><div class="t m0 x1 h2 y1c ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc1">end</span></div><div class="t m0 x1 h2 y1d ff1 fs0 fc0 sc0 ls0 ws0"> plot_process(centers)</div><div class="t m0 x1 h2 y1e ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc1">end</span></div><div class="t m0 x1 h2 y1f ff1 fs0 fc0 sc0 ls0 ws0"> </div><div class="t m0 x1 h2 y20 ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc1">if</span> (iter/100 == floor(i<span class="fc6 sc0">ter/100)),</span></div><div class="t m0 x1 h2 y21 ff1 fs0 fc0 sc0 ls0 ws0"> disp(['Iteration nu<span class="fc6 sc0">mber ' num2str(iter)])</span></div><div class="t m0 x1 h2 y22 ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc1">end</span></div><div class="t m0 x1 h2 y23 ff1 fs0 fc0 sc0 ls0 ws0"> </div><div class="t m0 x1 h2 y24 ff1 fs0 fc1 sc0 ls0 ws0">end</div><div class="t m0 x1 h2 y25 ff1 fs0 fc2 sc0 ls0 ws0">%Assign a weigh<span class="fc6 sc0">t to each feature</span></div><div class="t m0 x1 h2 y26 ff1 fs0 fc0 sc0 ls0 ws0">label = zeros(1,L);</div><div class="t m0 x1 h2 y27 ff1 fs0 fc1 sc0 ls0 ws0">for <span class="fc0">i = 1:L,</span></div><div class="t m0 x1 h2 y28 ff1 fs0 fc0 sc0 ls0 ws0"> net_k = W'*train_features(:,i);</div><div class="t m0 x1 h2 y29 ff1 fs0 fc0 sc0 ls0 ws0"> label(i) = find(net_k == max(net_k));</div><div class="t m0 x1 h2 y2a ff1 fs0 fc1 sc0 ls0 ws0">end</div><div class="t m0 x1 h2 y2b ff1 fs0 fc2 sc0 ls0 ws0">%Find the target for each weight<span class="fc6 sc0"> </span>and the ne<span class="fc6 sc0">w features</span></div><div class="t m0 x1 h2 y2c ff1 fs0 fc0 sc0 ls0 ws0">targets = zeros(1,Nmu);</div><div class="t m0 x1 h2 y2d ff1 fs0 fc0 sc0 ls0 ws0">features = zeros(D, Nmu);</div><div class="t m0 x1 h2 y2e ff1 fs0 fc1 sc0 ls0 ws0">for <span class="fc0">i = 1:Nmu,</span></div><div class="t m0 x1 h2 y2f ff1 fs0 fc0 sc0 ls0 ws0"> in = find(label == i);</div><div class="t m0 x1 h2 y30 ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc1">if</span> ~isempty(in),</div><div class="t m0 x1 h2 y31 ff1 fs0 fc0 sc0 ls0 ws0"> targets(i) = sum(train_targets(in)) <span class="fc6 sc0">/ length(in) &gt; .5;</span></div><div class="t m0 x1 h2 y32 ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc1">if</span> length(in) == 1,</div><div class="t m0 x1 h2 y33 ff1 fs0 fc0 sc0 ls0 ws0"> features(:,i) = train_features(:,i<span class="fc6 sc0">n);</span></div><div class="t m0 x1 h2 y34 ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc1">else</span></div><div class="t m0 x1 h2 y35 ff1 fs0 fc0 sc0 ls0 ws0"> features(:,i) = mean(train_featur<span class="fc6 sc0">es(:,in)')';</span></div><div class="t m0 x1 h2 y36 ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc1">end</span></div><div class="t m0 x1 h2 y37 ff1 fs0 fc0 sc0 ls0 ws0"> <span class="fc1">end</span></div><div class="t m0 x1 h2 y38 ff1 fs0 fc1 sc0 ls0 ws0">end</div><div class="t m1 x3 h4 y39 ff3 fs2 fc4 sc0 ls0 ws0">Da<span class="_ _0"></span>vid G. Stork</div><div class="t m1 x3 h4 y3a ff3 fs2 fc4 sc0 ls0 ws1">Elad Y<span class="_ _1"></span>om-T<span class="_ _2"></span>o<span class="_ _0"></span>v</div><div class="t m1 x4 h5 y3b ff4 fs3 fc5 sc0 ls0 ws0">Computer Manual</div><div class="t m1 x5 h5 y3c ff4 fs3 fc5 sc0 ls0 ws0">in MA<span class="_ _3"></span>TLAB</div><div class="t m1 x6 h5 y3d ff4 fs3 fc5 sc0 ls0 ws0">to accompany</div><div class="t m1 x7 h6 y3e ff3 fs4 fc5 sc0 ls0 ws0">P<span class="_ _0"></span>attern</div><div class="t m1 x7 h6 y3f ff3 fs4 fc5 sc0 ls0 ws0">Classif<span class="_ _4"></span>ication</div><div class="t m2 x8 h7 y40 ff3 fs5 fc5 sc0 ls0 ws0"> </div></div><div class="pi" data-data='{"ctm":[1.777778,0.000000,0.000000,1.777778,-64.000000,-128.000000]}'></div></div> </body> </html>
评论
    相关推荐
    • 神经网络分类matlab程序
      使用matlab编写的神经网络分类程序,方便实用 使用matlab编写的神经网络分类程序,方便实用 使用matlab编写的神经网络分类程序,方便实用 使用matlab编写的神经网络分类程序,方便实用
    • 朴素贝叶斯分类matlab实现
      分类算法是统计学分类方法,它是一类利用概率统计知识进行分类的算法。在许多场合,朴素贝叶斯(Naïve Bayes,NB)分类算法可以与决策树和神经网络分类算法相媲美,该算法能运用到大型数据库中,且方法简单、分类...
    • 分类MATLAB程序
      十几个程序,谱聚类的完整例子,有详细的例子,绝对物有所值,包括花朵分类,核函数等,MATLAB程序,下载绝对值得!包括研究生写论文,也是值得参考
    • SVM文本分类MatLAB源代码
      SVM文本分类MatLAB源代码 为m-file格式
    • 多层ELM进行MNIST手写字符分类MATLAB代码
      多层ELM进行MNIST手写字符分类MATLAB代码,直接运行.m程序,如果现实内存溢出,请改小隐藏节点个数。
    • Fisher分类MATLAB算法.rar
      手写数字识别Fisher分类MATLAB算法。内有程序,8个数字样本的训练样本。数字的特征提取部分解压后请见project report.ppt.
    • 高维多标签分类matlab
      高维多标签分类matlab knn,svm,随机森林等算法 784维数据 分为10类
    • svm多分类matlab程序
      svm多分类matlab程序,包括一对一、一对余等二叉树分类算法
    • 神经网络分类matlab程序
      使用matlab编写的神经网络分类程序,方便实用
    • SIM800C_MQTT.rar
      使用SIM800C模块,使用MQTT协议,连接中国移动onenet平台,能实现数据的订阅、发布、存储等