confmatget.html

来自「一个关于数据聚类和模式识别的程序,在生物化学,化学中因该都可以用到.希望对大家有」· HTML 代码 · 共 86 行

HTML
86
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"                "http://www.w3.org/TR/REC-html40/loose.dtd"><html><head>  <title>Description of confMatGet</title>  <meta name="keywords" content="confMatGet">  <meta name="description" content="confMatGet: Get confusion matrix from recognition result">  <meta http-equiv="Content-Type" content="text/html; charset=big5">  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">  <meta name="robots" content="index, follow">  <link type="text/css" rel="stylesheet" href="../m2html.css"></head><body><a name="_top"></a><div><a href="../index.html">Home</a> &gt;  <a href="index.html">dcpr</a> &gt; confMatGet.m</div><!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td><td align="right"><a href="index.html">Index for dcpr&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>--><h1>confMatGet</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>confMatGet: Get confusion matrix from recognition result</strong></div><h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>function confMat = confMatGet(desiredOutput, computedOutput) </strong></div><h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre class="comment"> confMatGet: Get confusion matrix from recognition result
    Usage: confMat = confMatGet(desiredOutput, computedOutput)

    For example:
        desired=[1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5];
        computed=[1 5 5 1 1 1 1 1 5 5 1 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 2 5 5 5 5 5 5 5 5 3 5 5 5];
        confMat = confMatGet(desired, computed);
        confMatPlot(confMat);</pre></div><!-- crossreference --><h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>This function calls:<ul style="list-style-image:url(../matlabicon.gif)"><li><a href="confMatGet.html" class="code" title="function confMat = confMatGet(desiredOutput, computedOutput)">confMatGet</a>	confMatGet: Get confusion matrix from recognition result</li><li><a href="confMatPlot.html" class="code" title="function overall=confMatPlot(confMat, className)">confMatPlot</a>	confMatPlot: Display the confusion matrix</li></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"><li><a href="confMatGet.html" class="code" title="function confMat = confMatGet(desiredOutput, computedOutput)">confMatGet</a>	confMatGet: Get confusion matrix from recognition result</li><li><a href="confMatPlot.html" class="code" title="function overall=confMatPlot(confMat, className)">confMatPlot</a>	confMatPlot: Display the confusion matrix</li></ul><!-- crossreference --><h2><a name="_subfunctions"></a>SUBFUNCTIONS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><ul style="list-style-image:url(../matlabicon.gif)"><li><a href="#_sub1" class="code">function selfdemo</a></li></ul><h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function confMat = confMatGet(desiredOutput, computedOutput)</a>0002 <span class="comment">% confMatGet: Get confusion matrix from recognition result</span>0003 <span class="comment">%    Usage: confMat = confMatGet(desiredOutput, computedOutput)</span>0004 <span class="comment">%</span>0005 <span class="comment">%    For example:</span>0006 <span class="comment">%        desired=[1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5];</span>0007 <span class="comment">%        computed=[1 5 5 1 1 1 1 1 5 5 1 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 2 5 5 5 5 5 5 5 5 3 5 5 5];</span>0008 <span class="comment">%        confMat = confMatGet(desired, computed);</span>0009 <span class="comment">%        confMatPlot(confMat);</span>0010 0011 <span class="comment">%    Roger Jang, 20060523, 20070504</span>0012 0013 <span class="keyword">if</span> nargin&lt;1, <a href="#_sub1" class="code" title="subfunction selfdemo">selfdemo</a>; <span class="keyword">return</span>; <span class="keyword">end</span>0014 0015 classCount=length(unique(desiredOutput));0016 0017 confMat=zeros(classCount, classCount);0018 <span class="keyword">for</span> i=1:classCount0019     index=find(desiredOutput==i);0020     roi=computedOutput(index);0021     <span class="keyword">for</span> j=1:classCount0022         confMat(i,j)=length(find(roi==j));0023     <span class="keyword">end</span>0024 <span class="keyword">end</span>0025 0026 <span class="comment">% ====== Self demo</span>0027 <a name="_sub1" href="#_subfunctions" class="code">function selfdemo</a>0028 desired=[1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5];0029 computed=[1 5 5 1 1 1 1 1 5 5 1 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 2 5 5 5 5 5 5 5 5 3 5 5 5];0030 confMat = <a href="confMatGet.html" class="code" title="function confMat = confMatGet(desiredOutput, computedOutput)">confMatGet</a>(desired, computed);0031 <a href="confMatPlot.html" class="code" title="function overall=confMatPlot(confMat, className)">confMatPlot</a>(confMat);</pre></div><hr><address>Generated on Thu 30-Oct-2008 12:53:56 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?