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

📄 tunerf.html

📁 本程序是基于linux系统下c++代码
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Tune randomForest for the optimal mtry parameter</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 tuneRF {randomForest}"><tr><td>tuneRF {randomForest}</td><td align="right">R Documentation</td></tr></table>
<h2>Tune randomForest for the optimal mtry parameter</h2>


<h3>Description</h3>

<p>
Starting with the default value of mtry, search for the optimal value
(with respect to Out-of-Bag error estimate) of mtry for randomForest.
</p>


<h3>Usage</h3>

<pre>
tuneRF(x, y, mtryStart, ntreeTry=50, stepFactor=2, improve=0.05,
       trace=TRUE, plot=TRUE, doBest=FALSE, ...)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>x</code></td>
<td>
matrix or data frame of predictor variables</td></tr>
<tr valign="top"><td><code>y</code></td>
<td>
response vector (factor for classification, numeric for
regression)</td></tr>
<tr valign="top"><td><code>mtryStart</code></td>
<td>
starting value of mtry; default is the same as in
<code><a href="randomForest.html">randomForest</a></code></td></tr>
<tr valign="top"><td><code>ntreeTry</code></td>
<td>
number of trees used at the tuning step</td></tr>
<tr valign="top"><td><code>stepFactor</code></td>
<td>
at each iteration, mtry is inflated (or deflated) by
this value</td></tr>
<tr valign="top"><td><code>improve</code></td>
<td>
the (relative) improvement in OOB error must be by this
much for the search to continue</td></tr>
<tr valign="top"><td><code>trace</code></td>
<td>
whether to print the progress of the search</td></tr>
<tr valign="top"><td><code>plot</code></td>
<td>
whether to plot the OOB error as function of mtry</td></tr>
<tr valign="top"><td><code>doBest</code></td>
<td>
whether to run a forest using the optimal mtry found</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
options to be given to <code><a href="randomForest.html">randomForest</a></code></td></tr>
</table>

<h3>Value</h3>

<p>
If <code>doBest=FALSE</code> (default), it returns a matrix whose first
column contains the mtry values searched, and the second column the
corresponding OOB error.
<br>
If <code>doBest=TRUE</code>, it returns the <code><a href="randomForest.html">randomForest</a></code>
object produced with the optimal <code>mtry</code>.</p>

<h3>See Also</h3>

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


<h3>Examples</h3>

<pre>
data(fgl, package="MASS")
fgl.res &lt;- tuneRF(fgl[,-10], fgl[,10], stepFactor=1.5)
</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 + -