1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/predict.R
\name{predict.WrappedModel}
\alias{predict.WrappedModel}
\title{Predict new data.}
\usage{
\method{predict}{WrappedModel}(object, task, newdata, subset = NULL, ...)
}
\arguments{
\item{object}{(\link{WrappedModel})\cr
Wrapped model, result of \link{train}.}
\item{task}{(\link{Task})\cr
The task. If this is passed, data from this task is predicted.}
\item{newdata}{(\link{data.frame})\cr
New observations which should be predicted.
Pass this alternatively instead of \code{task}.}
\item{subset}{(\link{integer} | \link{logical} | \code{NULL})\cr
Selected cases. Either a logical or an index vector.
By default \code{NULL} if all observations are used.}
\item{...}{(any)\cr
Currently ignored.}
}
\value{
(\link{Prediction}).
}
\description{
Predict the target variable of new data using a fitted model.
What is stored exactly in the (\link{Prediction}) object depends
on the \code{predict.type} setting of the \link{Learner}.
If \code{predict.type} was set to \dQuote{prob} probability thresholding
can be done calling the \link{setThreshold} function on the
prediction object.
The row names of the input \code{task} or \code{newdata} are preserved in the output.
}
\examples{
\dontshow{ if (requireNamespace("MASS")) \{ }
# train and predict
train.set = seq(1, 150, 2)
test.set = seq(2, 150, 2)
model = train("classif.lda", iris.task, subset = train.set)
p = predict(model, newdata = iris, subset = test.set)
print(p)
predict(model, task = iris.task, subset = test.set)
# predict now probabiliies instead of class labels
lrn = makeLearner("classif.lda", predict.type = "prob")
model = train(lrn, iris.task, subset = train.set)
p = predict(model, task = iris.task, subset = test.set)
print(p)
getPredictionProbabilities(p)
\dontshow{ \} }
}
\seealso{
Other predict:
\code{\link{asROCRPrediction}()},
\code{\link{getPredictionProbabilities}()},
\code{\link{getPredictionResponse}()},
\code{\link{getPredictionTaskDesc}()},
\code{\link{setPredictThreshold}()},
\code{\link{setPredictType}()}
}
\concept{predict}
|