predict.html
来自「本程序是基于linux系统下c++代码」· HTML 代码 · 共 95 行
HTML
95 行
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Model Predictions</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 predict {arules}"><tr><td>predict {arules}</td><td align="right">R Documentation</td></tr></table>
<h2>Model Predictions</h2>
<h3>Description</h3>
<p>
Provides the S4 method <code>predict</code> for <code>itemMatrix</code> (e.g.,
transactions). Predicts the membership (nearest neighbor) of new data to
clusters represented by medoids or labeled examples.
</p>
<h3>Usage</h3>
<pre>
## S4 method for signature 'itemMatrix':
predict(object, newdata, labels = NULL, blocksize = 200,...)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>object</code></td>
<td>
medoids (no labels needed) or examples (labels needed). </td></tr>
<tr valign="top"><td><code>newdata</code></td>
<td>
objects to predict labels for. </td></tr>
<tr valign="top"><td><code>labels</code></td>
<td>
an integer vector containing the labels for the examples in
<code>object</code>. </td></tr>
<tr valign="top"><td><code>blocksize</code></td>
<td>
a numeric scalar indicating how much memory predict can
use for big <code>x</code> and/or <code>y</code> (approx. in MB). This is only a crude
approximation for 32-bit machines (64-bit architectures need double the
blocksize in memory) and using the default Jaccard method for dissimilarity
calculation. In general, reducing <code>blocksize</code> will decrease the
memory usage but will increase the run-time.</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
further arguments passed on to <code>dissimilarity</code>. E.g.,
<code>method</code>.</td></tr>
</table>
<h3>Value</h3>
<p>
An integer vector of the same length as <code>newdata</code>
containing the predicted labels for each element.</p>
<h3>See Also</h3>
<p>
<code><a href="dissimilarity.html">dissimilarity</a></code>,
<code><a href="itemMatrix-class.html">itemMatrix-class</a></code>
</p>
<h3>Examples</h3>
<pre>
data("Adult")
## sample
small <- sample(Adult, 500)
large <- sample(Adult, 5000)
## cluster a small sample
d_jaccard <- dissimilarity(small)
hc <- hclust(d_jaccard)
l <- cutree(hc, k=4)
## predict labels for a larger sample
labels <- predict(small, large, l)
## plot the profile of the 1. cluster
itemFrequencyPlot(large[labels==1, itemFrequency(large) > 0.1])
</pre>
<hr><div align="center">[Package <em>arules</em> version 0.6-6 <a href="00Index.html">Index]</a></div>
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?