⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gettree.html

📁 本程序是基于linux系统下c++代码
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Extract a single tree from a forest.</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 getTree {randomForest}"><tr><td>getTree {randomForest}</td><td align="right">R Documentation</td></tr></table>
<h2>Extract a single tree from a forest.</h2>


<h3>Description</h3>

<p>
This function extract the structure of a tree from a
<code>randomForest</code> object.
</p>


<h3>Usage</h3>

<pre>
getTree(rfobj, k=1, labelVar=FALSE)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>rfobj</code></td>
<td>
a <code><a href="randomForest.html">randomForest</a></code> object.</td></tr>
<tr valign="top"><td><code>k</code></td>
<td>
which tree to extract?</td></tr>
<tr valign="top"><td><code>labelVar</code></td>
<td>
Should better labels be used for splitting variables
and predicted class?</td></tr>
</table>

<h3>Details</h3>

<p>
For numerical predictors, data with values of the variable less than
the splitting point go to the left daughter node.
</p>
<p>
For categorical predictors, the splitting point is represented by an
integer, whose binary expansion gives the identities of the categories
that goes to left or right.  For example, if a predictor has three
categories, and the split point is 5.  The binary expansion of 5 is
(1, 0, 1) (because <i>5 = 1*2^0 + 0*2^1 + 1*2^2</i>), so cases with
categories 1 or 3 in this predictor get sent to the left, and the rest
to the right.
</p>


<h3>Value</h3>

<p>
A matrix (or data frame, if <code>labelVar=TRUE</code>) with six columns and
number of rows equal to total number of nodes in the tree.  The six
columns are: 
</p>
<table summary="R argblock">
<tr valign="top"><td><code>left daughter</code></td>
<td>
the row where the left daughter node is; 0 if the
node is terminal</td></tr>
<tr valign="top"><td><code>right daughter</code></td>
<td>
the row where the right daughter node is; 0 if
the node is terminal</td></tr>
<tr valign="top"><td><code>split var</code></td>
<td>
which variable was used to split the node; 0 if the
node is terminal</td></tr>
<tr valign="top"><td><code>split point</code></td>
<td>
where the best split is; see Details for
categorical predictor</td></tr>
<tr valign="top"><td><code>status</code></td>
<td>
is the node terminal (-1) or not (1)</td></tr>
<tr valign="top"><td><code>prediction</code></td>
<td>
the prediction for the node; 0 if the node is not
terminal</td></tr>
</table>

<h3>Author(s)</h3>

<p>
Andy Liaw <a href="mailto:andy_liaw@merck.com">andy_liaw@merck.com</a>
</p>


<h3>See Also</h3>

<p>
<code><a href="randomForest.html">randomForest</a></code>
</p>


<h3>Examples</h3>

<pre>
data(iris)
## Look at the third trees in the forest.
getTree(randomForest(iris[,-5], iris[,5], ntree=10), 3, labelVar=TRUE)
</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 + -