reduce.nn.html

来自「本程序是基于linux系统下c++代码」· HTML 代码 · 共 98 行

HTML
98
字号
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Reduce Training Set for a k-NN Classifier</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../R.css">
</head><body>

<table width="100%" summary="page for reduce.nn {class}"><tr><td>reduce.nn {class}</td><td align="right">R Documentation</td></tr></table>
<h2>Reduce Training Set for a k-NN Classifier</h2>


<h3>Description</h3>

<p>
Reduce training set for a k-NN classifier. Used after <code>condense</code>.
</p>


<h3>Usage</h3>

<pre>
reduce.nn(train, ind, class)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>train</code></td>
<td>
matrix for training set
</td></tr>
<tr valign="top"><td><code>ind</code></td>
<td>
Initial list of members of the training set (from <code>condense</code>).
</td></tr>
<tr valign="top"><td><code>class</code></td>
<td>
vector of classifications for test set
</td></tr>
</table>

<h3>Details</h3>

<p>
All the members of the training set are tried in random order.
Any which when dropped do not cause any members of the training set to
be wrongly classified are dropped.
</p>


<h3>Value</h3>

<p>
index vector of cases to be retained.</p>

<h3>References</h3>

<p>
Gates, G.W. (1972) The reduced nearest neighbor rule.
<EM>IEEE Trans. Information Theory</EM>
<B>IT-18</B>, 431&ndash;432.
</p>
<p>
Ripley, B. D. (1996)
<EM>Pattern Recognition and Neural Networks.</EM> Cambridge.
</p>
<p>
Venables, W. N. and Ripley, B. D. (2002)
<EM>Modern Applied Statistics with S.</EM> Fourth edition.  Springer.
</p>


<h3>See Also</h3>

<p>
<code><a href="condense.html">condense</a></code>, <code><a href="multiedit.html">multiedit</a></code>
</p>


<h3>Examples</h3>

<pre>
data(iris3)
train &lt;- rbind(iris3[1:25,,1], iris3[1:25,,2], iris3[1:25,,3])
test &lt;- rbind(iris3[26:50,,1], iris3[26:50,,2], iris3[26:50,,3])
cl &lt;- factor(c(rep("s",25), rep("c",25), rep("v",25)))
keep &lt;- condense(train, cl)
knn(train[keep,], test, cl[keep])
keep2 &lt;- reduce.nn(train, keep, cl)
knn(train[keep2,], test, cl[keep2])
</pre>



<hr><div align="center">[Package <em>class</em> version 7.2-44 <a href="00Index.html">Index]</a></div>

</body></html>

⌨️ 快捷键说明

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