loss.matrix(rpartOrdinal)
loss.matrix()所属R语言包:rpartOrdinal
Generalized Gini Impurity
广义吉尼杂质的
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function implements the Generalized Gini impurity splitting method for use in rpart. This method factors in the cost or loss associated with classifying an observation of class h as g, or C(g|h), into the node impurity measure.
此功能实现的广义吉尼杂质的分离方法中使用的软件rpart。这种方法与分类观察H级,G或C(G | H),到节点杂质措施的费用或损失的因素。
用法----------Usage----------
loss.matrix( method, y)
参数----------Arguments----------
参数:method
either "linear" for linear loss or "quadratic" for quadratic loss
无论是“线性”的线性损失或二次损失“二次”
参数:y
is the ordered factor to be predicted
是要被预测的有序因子
(作者)----------Author(s)----------
Kellie J. Archer, kjarcher@vcu.edu
参考文献----------References----------
参见----------See Also----------
rpart
rpart
实例----------Examples----------
library(rpartOrdinal)
data(lowbwt)
lowbwt$Category<-factor(ifelse(lowbwt$bwt<=2500,3,ifelse(lowbwt$bwt<=3000,2,
ifelse(lowbwt$bwt<=3500,1,0))),ordered=TRUE)
library(rpart)
linear.loss.rpart<-rpart(Category~age+lwt+race+smoke+ptl+ht+ui+ftv,data=lowbwt,
parms = list(loss = loss.matrix(method="linear",lowbwt$Category)))
plot(linear.loss.rpart)
text(linear.loss.rpart)
quadratic.loss.rpart<-rpart(Category~age+lwt+race+smoke+ptl+ht+ui+ftv,data=lowbwt,
parms = list(loss = loss.matrix(method="quad",lowbwt$Category)))
plot(quadratic.loss.rpart)
text(quadratic.loss.rpart,pretty=TRUE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|