tsp.randomForest(x, y = NULL, xtest = NULL, ytest = NULL, ntree = 500, type = "classification", mtry = if (!is.null(y) && !is.factor(y)) max(floor(ncol(x)/3), 1) else floor(sqrt(ncol(x))), replace = TRUE, classwt = NULL, cutoff, strata, sampsize = if (replace) nrow(x) else ceiling(0.632 * nrow(x)), nodesize = if (!is.null(y) && !is.factor(y)) 5 else 1, maxnodes = NULL, importance = FALSE, localImp = FALSE, nPerm = 1, proximity = FALSE, oob.prox = proximity, norm.votes = TRUE, do.trace = FALSE, keep.forest = !is.null(y) && is.null(xtest), keep.inbag = FALSE, ...)
'winning'
class for an observation is the one with the maximum ratio of proportion of votes to cutoff. Default is 1/k
where k is the number of classes (i.e., majority vote wins).
randomForest
regression
, classification
, or
unsupervised
.nclass
+ 2 (for classification)
or two (for regression) columns. For classification, the first
nclass
columns are the class-specific measures computed as
mean descrease in accuracy. The nclass
+ 1st column is the
mean descrease in accuracy over all classes. The last column is the
mean decrease in Gini index. For Regression, the first column is
the mean decrease in accuracy and the second the mean decrease in MSE.
If importance=FALSE
, the last measure is still returned as a
vector.p
by nclass
+ 1
matrix corresponding to the first nclass + 1
columns
of the importance matrix. For regression, a length p
vector.NULL
if localImp=FALSE
.NULL
if
randomForest
is run in unsupervised mode or if
keep.forest=FALSE
.proximity=TRUE
when
randomForest
is called, a matrix of proximity measures among
the input (based on the frequency that pairs of data points are in
the same terminal nodes).n
.mse
/
Var(y).xtest
or additionally
ytest
arguments), this component is a list which contains the
corresponding predicted
, err.rate
, confusion
,
votes
(for classification) or predicted
, mse
and
rsq
(for regression) for the test set. If
proximity=TRUE
, there is also a component, proximity
,
which contains the proximity among the test set as well as proximity
between test and training data.predict.tsp.randomForest
library(randomForest)
x=matrix(rnorm(100*20),100,20)
y=rbinom(100,1,0.5)
y=as.factor(y)
fit=tsp.randomForest(x,y)
predict(fit,x[1:10,])
plot(fit)
Run the code above in your browser using DataLab