📄 classcenter
字号:
classCenter package:randomForest R Documentation
_P_r_o_t_o_t_y_p_e_s _o_f _g_r_o_u_p_s.
_D_e_s_c_r_i_p_t_i_o_n:
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 'prototype' in the 'methods' package.
_U_s_a_g_e:
classCenter(x, label, prox, nNbr = min(table(label))-1)
_A_r_g_u_m_e_n_t_s:
x: a matrix or data frame
label: group labels of the rows in 'x'
prox: 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 'x')
nNbr: number of nearest neighbors used to find the prototypes.
_D_e_t_a_i_l_s:
This version only computes one prototype per class. For each case
in 'x', the 'nNbr' 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).
This version only computes one prototype per class. In the future
more prototypes may be computed (by removing the `neighbors' used,
then iterate).
_V_a_l_u_e:
A data frame containing one prototype in each row.
_A_u_t_h_o_r(_s):
Andy Liaw
_S_e_e _A_l_s_o:
'randomForest', 'MDSplot'
_E_x_a_m_p_l_e_s:
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"))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -