📄 bayes.html
字号:
<pre> Sex Age Blood_pressure Drug bc male 20 normal A A female 73 normal B B female 37 high A A male 33 low B B female 48 high A A male 29 normal A A female 52 normal B B male 42 low B B male 61 normal B B female 30 normal A A female 26 low B B male 54 high A A</pre><p>That is, the classification is perfect, which is not surprisingfor such a simple example. The columns are neatly aligned becauseof the <tt>-a</tt> option. Without it, there would only be a singlespace between two column values.</p><table width="100%" border=0 cellpadding=0 cellspacing=0><tr><td width="95%" align=right><a href="#top">back to the top</a></td> <td width=5></td> <td><a href="#top"><img src="uparrow.gif" border=0></a></td></tr></table><!-- =============================================================== --><p><img src="line.gif" alt="" height=7 width=704></p><h3><a name="xmat">Computing a Confusion Matrix</a></h3><p>The classification quality can be inspected in more detail withthe program <tt>xmat</tt> (determine a confusion matrix, to be foundin the table package, see below):</p><pre> xmat drug.cls</pre><p>This program reads the output of the program <tt>bcx</tt> andcomputes a confusion matrix from two columns of this file. It usesthe last two columns by default (the last column for the x- and thesemi-last for the y-direction), which is fine for our example. Othercolumns can be selected via the options <tt>-x</tt> and <tt>-y</tt>followed by the name of the column that is to be used for the x- ory-direction of the confusion matrix. The output of the program<tt>xmat</tt>, which by default is written to the terminal, shouldread like this:</p><pre> confusion matrix for Drug vs. bc: no | value | 1 2 | errors ----+--------+---------------+------- 1 | A | 6 0 | 0 2 | B | 0 6 | 0 ----+--------+---------------+------- | errors | 0 0 | 0</pre><p>In this matrix the x-direction corresponds to the column <tt>bc</tt>and the y-direction to the column <tt>Drug</tt>. Since in our simpleexample the classification is perfect, only the fields in the diagonaldiffer from zero. If the classification is not perfect, the otherfields show what errors are made by the decision tree classifier.</p><table width="100%" border=0 cellpadding=0 cellspacing=0><tr><td width="95%" align=right><a href="#top">back to the top</a></td> <td width=5></td> <td><a href="#top"><img src="uparrow.gif" border=0></a></td></tr></table><!-- =============================================================== --><p><img src="line.gif" alt="" height=7 width=704></p><h3><a name="gendb">Generating a Database</a></h3><p>The program <tt>bcdb</tt> can be used to generate a database ofsample cases from a full or naive Bayes classifier. For example,invoking it with</p><pre> bcdb test.fbc test.tab</pre><p>generates a database with 1000 tuples from the full Bayes classifier<tt>test.fbc</tt> that can be found in the directory <tt>ex</tt>.The number of tuples to be generated can be changed with the option<tt>-n#</tt>, where <tt>#</tt> is to be replaced by the desired number.For other options call the program without any arguments.</p><table width="100%" border=0 cellpadding=0 cellspacing=0><tr><td width="95%" align=right><a href="#top">back to the top</a></td> <td width=5></td> <td><a href="#top"><img src="uparrow.gif" border=0></a></td></tr></table><!-- =============================================================== --><p><img src="line.gif" alt="" height=7 width=704></p><h3><a name="corr">Computing Covariances and Correlation Coefficients</a></h3><p>The program <tt>corr</tt> can be used to computed covariancesand correlation coefficients. By invoking it with</p><pre> correl -xvc iris.tab</pre><p>the expected values and standard deviations (option <tt>-x</tt>),the covariances (option <tt>-v</tt>) and the correlation coefficients(option <tt>-c</tt>) for the four numeric attributes of the well-knowniris data are computed. The output should look like this:</p><pre> no | attribute | exp. val. | std. dev. ---+--------------+-----------+---------- 1 | sepal_length | 5.843333 | 0.825301 2 | sepal_width | 3.057333 | 0.434411 3 | petal_length | 3.758000 | 1.759404 4 | petal_width | 1.199333 | 0.759693 covariance matrix no | attribute | 1 2 3 4 ---+--------------+------------------------------------ 1 | sepal_length | 0.68112 -0.04215 1.26582 0.51283 2 | sepal_width | 0.18871 -0.32746 -0.12083 3 | petal_length | 3.09550 1.28697 4 | petal_width | 0.57713 correlation coefficients no | attribute | 1 2 3 4 ---+--------------+------------------------ 1 | sepal_length | 1.00 -.118 .872 .818 2 | sepal_width | 1.00 -.428 -.366 3 | petal_length | 1.00 .963 4 | petal_width | 1.00</pre><table width="100%" border=0 cellpadding=0 cellspacing=0><tr><td width="95%" align=right><a href="#top">back to the top</a></td> <td width=5></td> <td><a href="#top"><img src="uparrow.gif" border=0></a></td></tr></table><!-- =============================================================== --><p><img src="line.gif" alt="" height=7 width=704></p><h3><a name="copying">Copying</a></h3><p>bci/bcx/bcdb/corr - induce and execute full and naive Bayes classifiers<br> copyright © 1996-2003 Christian Borgelt</p><p>These programs are free software; you can redistribute themand/or modify them under the terms of the<a href="http://www.fsf.org/copyleft/lesser.html">GNU Lesser (Library) General Public License</a> as published by the<a href="http://www.fsf.org">Free Software Foundation</a>.</p><p>These programs are distributed in the hope that they will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<a href="http://www.fsf.org/copyleft/lesser.html">GNU Lesser (Library) General Public License</a> for more details.</p><table width="100%" border=0 cellpadding=0 cellspacing=0><tr><td width="95%" align=right><a href="#top">back to the top</a></td> <td width=5></td> <td><a href="#top"><img src="uparrow.gif" border=0></a></td></tr></table><!-- =============================================================== --><p><img src="line.gif" alt="" height=7 width=704></p><h3><a name="download">Download</a></h3><p><a href="http://fuzzy.cs.uni-magdeburg.de/~borgelt/bayes.html">Download page</a> with most recent version.</p><table width="100%" border=0 cellpadding=0 cellspacing=0><tr><td width="95%" align=right><a href="#top">back to the top</a></td> <td width=5></td> <td><a href="#top"><img src="uparrow.gif" border=0></a></td></tr></table><!-- =============================================================== --><p><img src="line.gif" alt="" height=7 width=704></p><h3><a name="contact">Contact</a></h3><table border=0 cellpadding=0 cellspacing=0><tr><td valign=top>Snail mail:</td><td width=10></td> <td><a href="http://fuzzy.cs.uni-magdeburg.de/~borgelt/index.html"> Christian Borgelt</a><br> <a href="http://fuzzy.cs.uni-magdeburg.de/index.html"> Working Group Neural Networks and Fuzzy Systems</a><br> <a href="http://www-iws.cs.uni-magdeburg.de/iws.html"> Department of Knowledge Processing and Language Engineering</a><br> <a href="http://www.cs.uni-magdeburg.de/"> School of Computer Science</a><br> <a href="http://www.uni-magdeburg.de/"> Otto-von-Guericke-University of Magdeburg</a><br> Universitätsplatz 2<br> D-39106 Magdeburg<br> Germany</td></tr><tr><td valign=top>E-mail:</td><td></td> <td><a href="mailto:christian.borgelt@cs.uni-magdeburg.de"> christian.borgelt@cs.uni-magdeburg.de</a><br> <a href="mailto:borgelt@iws.cs.uni-magdeburg.de"> borgelt@iws.cs.uni-magdeburg.de</a></td></tr><tr><td>Phone:</td><td></td> <td>+49 391 67 12700</td></tr><tr><td>Fax:</td><td></td> <td>+49 391 67 12018</td></tr><tr><td>Office:</td><td></td> <td>29.015</td></tr></table><table width="100%" border=0 cellpadding=0 cellspacing=0><tr><td width="95%" align=right><a href="#top">back to the top</a></td> <td width=5></td> <td><a href="#top"><img src="uparrow.gif" border=0></a></td></tr></table><!-- =============================================================== --><p><img src="line.gif" alt="" height=7 width=704></p><address>© 1999-2003<a href="mailto:borgelt@iws.cs.uni-magdeburg.de">Christian Borgelt</a></address><!-- Created: Thu May 24 12:28:05 CEST 2001 --><!-- hhmts start -->Last modified: Sat Apr 26 17:06:15 PDT 2003<!-- hhmts end --></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -