MINI MINI MANI MO
%
% Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
%
\name{ore.randomForest}
\alias{ore.randomForest}
\alias{grabTree}
\alias{grabTree.ore.randomForest}
\alias{predict.ore.randomForest}
\alias{print.ore.randomForest}
\title{
Oracle R Enterprise randomForest 函数
}
\description{
在 \code{ore.frame} 数据上创建随机森林模型用于
分类。
}
\usage{
ore.randomForest(formula, data, ntree=500, mtry = NULL,
replace = TRUE, classwt = NULL, cutoff = NULL,
sampsize = if(replace) nrow(data) else ceiling(0.632*nrow(data)),
nodesize = 1L, maxnodes = NULL, confusion.matrix = FALSE,
groups = getOption("ore.parallel", NULL), na.action = na.fail, ...)
### Specific methods for ore.randomForest objects
\method{grabTree}{ore.randomForest}(object, k = 1L, labelVar = FALSE, ...)
\method{predict}{ore.randomForest}(object, newdata,
type = c("response", "prob", "vote", "all"),
norm.votes = TRUE,
supplemental.cols = NULL,
cache.model = TRUE, ...)
\method{print}{ore.randomForest}(x, ...)
}
\arguments{
\item{formula}{
\code{\link[stats]{formula}} 对象表示要培训的
随机森林模型。
}
\item{data}{
一个用于指定模型数据的 \code{ore.frame}
对象。
}
\item{ntree}{
要生长的树的总数。
}
\item{mtry}{
在每个树节点拆分上随机采样作为候选项的
变量数。如果未指定此项, 它将设置为 \code{formula} 中属性数的平方根的
取整数。
}
\item{replace}{
一个逻辑值, 该值指示是否执行采样
并替换。
}
\item{classwt}{
类先验向量。如果指定, 则
向量的长度应等于目标列中类的数量。
向量无需合计为 1。
}
\item{cutoff}{
截断值向量。如果指定, 则向量的长度
应等于目标列中类的数量。
确定某个观察的预测类时, 将选择
具有最大表决截断比例的类。
如果未指定, 则默认值为 \code{1/k}, 其中
\code{k} 是类的数量。
}
\item{sampsize}{
为正在生长的树抽取的样本的大小。
}
\item{nodesize}{
终端节点的最小大小。
}
\item{maxnodes}{
要生长的各个树的终端节点的
最大大小。如果未指定, 则根据 \code{nodesize} 的限制,
树可以生长到最大大小。
}
\item{confusion.matrix}{
指示是否计算混淆矩阵
的逻辑值。请注意, 此混淆矩阵并非基于
OOB (袋外数据), 而是将构建随机森林模型
应用到整个培训数据的结果。
}
\item{groups}{
将树的总数划分为树组的数量。
默认值等于选项 \code{ore.parallel} 的值。
如果系统内存有限, 则建议为
此参数设置较大的数字, 这样可以
保持较小的各组大小来防止内存不足。
否则, 应将该参数保留为默认值。
}
\item{na.action}{
处理 \code{NA} 值所用的
方法。使用默认 \code{na.fail}, 如果培训数据
包含 \code{NA} 则失败。
}
\item{\dots}{
附加参数。
}
\item{object, x}{
一个 \code{ore.randomForest} 对象。
}
\item{k}{
指示要提取哪个树的信息的整数。
}
\item{labelVar}{
指示返回框架中的 \code{split
var} 和 \code{prediction} 列是否使用有意义
标签的逻辑值。
}
\item{newdata}{
\code{ore.frame} 对象, 测试数据。
}
\item{type}{
此参数指定输出的类型。值可以为
\code{response}, \code{prob}, \code{votes} 或 \code{all},
指示输出的类型: 预测值, 类概率矩阵,
表决计数矩阵, 或者同时包括表决矩阵和
预测值。
}
\item{norm.votes}{
指示是否应规范化输出表决矩阵中表决计数的
逻辑值。如果 \code{type} 为 \code{response} 或 \code{prob},
则忽略该参数。
}
\item{supplemental.cols}{
来自 \code{newdata} 数据集要包括在预测结果中的
附加列。
}
\item{cache.model}{
指示预测期间是否在内存中高速缓存整个
随机森林模型的逻辑值。
}
}
\value{
对于 \code{ore.randomForest}, 它返回类为 \code{ore.randomForest} 的
对象。其中一些组件如下所示:
\item{forest}{存储串行化生长树的 \code{ore.frame} 对象。}
\item{DOP}{构建模型使用的并行度。}
\item{confusion}{在将 \code{confusion.matrix} 指定为 \code{TRUE} 时,
将构建模型应用到培训数据时
生成的混淆矩阵。}
对于 \code{grabTree.ore.randomForest}, 它返回带有 \code{ore.frame} 树信息的
\code{kth}。每一行标识一个节点,
其中包含节点 ID, 子节点, 拆分变量,
拆分点, 节点的状态 (终端: \code{-1};
非终端: \code{1}) 和预测
对于 \code{predict.ore.randomForest}, 根据参数 \code{ore.frame}, 它返回
带有预测和/或表决矩阵的 \code{type}。
}
\details{
\code{ore.randomForest} 通过并行生长树构建
随机森林模型。该函数返回一个
\code{ore.randomForest} 对象。它要求安装 Oracle R Distribution
(ORD) 或 \code{randomForest} 程序包。程序包 \code{randomForest} 首选
Oracle R Distribution 以实现更好的
性能和兼容性。如果使用了程序包
\code{randomForest} 则发布警告。
计分方法 \code{predict} 并行运行。有足够内存可用时,
建议使用 \code{cache.model} \code{TRUE} 的默认值。
否则, 应将 \code{cache.model} 设置为
\code{FALSE} 防止过度使用内存。
\code{\link[OREbase:ore.options]{"ore.parallel"}} 使用 \code{ore.randomForest} 全局选项
来确定要在 Oracle R Enterprise 服务器中
使用的首选并行度。
}
\references{
\href{http://www.oracle.com/technetwork/database/database-technologies/r/r-enterprise/documentation/index.html}{Oracle R Enterprise}
}
\author{
Oracle \email{oracle-r-enterprise@oracle.com}
}
\seealso{
\code{\link[randomForest]{randomForest}},
\code{\link[OREbase:ore.options]{ore.parallel}}
}
\examples{
IRIS <- ore.push(iris)
mod <- ore.randomForest(Species~., IRIS)
tree10 <- grabTree(mod, k = 10, labelVar = TRUE)
ans <- predict(mod, IRIS, type="all", supplemental.cols="Species")
table(ans$Species, ans$prediction)
}
\keyword{randomForest}
OHA YOOOO