📄 classcenter.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Prototypes of groups.</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 classCenter {randomForest}"><tr><td>classCenter {randomForest}</td><td align="right">R Documentation</td></tr></table>
<h2>Prototypes of groups.</h2>
<h3>Description</h3>
<p>
Prototypes are `representative' cases of a group of data points, given
the similarity matrix among the points. They are very similar to
medoids. The function is named `classCenter' to avoid conflict with
the function <code>prototype</code> in the <code>methods</code> package.
</p>
<h3>Usage</h3>
<pre>
classCenter(x, label, prox, nNbr = min(table(label))-1)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>x</code></td>
<td>
a matrix or data frame</td></tr>
<tr valign="top"><td><code>label</code></td>
<td>
group labels of the rows in <code>x</code></td></tr>
<tr valign="top"><td><code>prox</code></td>
<td>
the proximity (or similarity) matrix, assumed to be
symmetric with 1 on the diagonal and in [0, 1] off the diagonal (the
order of row/column must match that of <code>x</code>)</td></tr>
<tr valign="top"><td><code>nNbr</code></td>
<td>
number of nearest neighbors used to find the prototypes.</td></tr>
</table>
<h3>Details</h3>
<p>
This version only computes one prototype per class. For each case in
<code>x</code>, the <code>nNbr</code> nearest neighors are found. Then, for each
class, the case that has most neighbors of that class is identified.
The prototype for that class is then the medoid of these neighbors
(coordinate-wise medians for numerical variables and modes for
categorical variables).
</p>
<p>
This version only computes one prototype per class. In the future
more prototypes may be computed (by removing the `neighbors' used,
then iterate).
</p>
<h3>Value</h3>
<p>
A data frame containing one prototype in each row.</p>
<h3>Author(s)</h3>
<p>
Andy Liaw
</p>
<h3>See Also</h3>
<p>
<code><a href="randomForest.html">randomForest</a></code>, <code><a href="MDSplot.html">MDSplot</a></code>
</p>
<h3>Examples</h3>
<pre>
data(iris)
iris.rf <- randomForest(iris[,-5], iris[,5], prox=TRUE)
iris.p <- classCenter(iris[,-5], iris[,5], iris.rf$prox)
plot(iris[,3], iris[,4], pch=21, xlab=names(iris)[3], ylab=names(iris)[4],
bg=c("red", "blue", "green")[as.numeric(factor(iris$Species))],
main="Iris Data with Prototypes")
points(iris.p[,3], iris.p[,4], pch=21, cex=2, bg=c("red", "blue", "green"))
</pre>
<hr><div align="center">[Package <em>randomForest</em> version 4.5-27 <a href="00Index.html">Index]</a></div>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -