Displaying 20 results from an estimated 25 matches for "ytest".
Did you mean:
test
2012 Nov 30
1
Baffled with as.matrix
I'm puzzled by as.matrix. It appears to work differently for Surv objects.
Here is a session from my computer:
tmt% R --vanilla
> library(survival)
Loading required package: splines
> ytest <- Surv(1:3, c(1,0,1))
> is.matrix(ytest)
>[1] TRUE
> attr(ytest, 'type')
[1] "right"
> attr(as.matrix(ytest), 'type')
[1] "right"
>
> y2 <- ytest
> class(y2) <- "charlie"
> as.matrix.charlie <- survival:::as...
2004 Apr 15
7
all(logical(0)) and any(logical(0))
Dear R-help,
I was bitten by the behavior of all() when given logical(0): It is TRUE!
(And any(logical(0)) is FALSE.) Wouldn't it be better to return logical(0)
in both cases?
The problem surfaced because some un-named individual called randomForest(x,
y, xtest, ytest,...), and gave y as a two-level factor, but ytest as just
numeric vector. I thought I check for that in my code by testing for
if (!all(levels(y) == levels(ytest))) stop(...)
but levels() on a non-factor returns NULL, and the comparison ended up being
logical(0). Since all(logical(0)) is TRUE,...
2008 Jun 15
1
randomForest, 'No forest component...' error while calling Predict()
...y help!
- Jim
CT <- read.table("CT.txt",header=TRUE,sep="\t")
CV <- read.table("CV.txt",header=TRUE,sep="\t")
# Both CT & CV have the syntaxis X1, X2,...,X97,Y where all variables are
numeric
x <- CT[,-98]
y <- CT[,98]
xtest <- CV[,-98]
ytest <- CV[,98]
library(randomForest)
model <- randomForest(x ,y , xtest,
ytest,ntree=500,mtry=32,nodesize=5,nPerm=2)
model
#Call:
# randomForest(x = x, y = y, xtest = xtest, ytest = ytest, ntree = 500,
mtry = 32, nodesize = 5,
# nPerm = 2)
# Type of random forest: regression...
2012 Oct 22
1
random forest
Hi all,
Can some one tell me the difference between the following two formulas?
1. epiG.rf <-randomForest(gamma~.,data=data, na.action = na.fail,ntree =
300,xtest = NULL, ytest = NULL,replace = T, proximity =F)
2.epiG.rf <-randomForest(gamma~.,data=data, na.action = na.fail,ntree =
300,xtest = NULL, ytest = NULL,replace = T, proximity =F)
[[alternative HTML version deleted]]
2001 Feb 21
1
glm predict problem with type = "response"
The standard errors produced by predict.glm with type = "response" seem
wrong. Here is an example using R 1.2 windows version along with the same
problem in Splus. The standard errors for type = "link" are the same in
both systems.
R1.2> set.seed(10)
R1.2> ytest <- 100*.95^(0:9) + rnorm(10,sd = 5)
R1.2> ytest
[1] 103.96964 97.60590 88.43220 85.90504 79.18262 76.05762 68.34566
[8] 74.24119 66.80257 62.95880
R1.2> foo <- glm(ytest~I(0:9),family=quasi(link=log))
R1.2> predict(foo,type="link")
1 2 3...
2004 Jan 20
1
random forest question
...45,0.1,0.45) would result in fewer
cases classified as class 2. Did I understand something wrong?
Christian
x1rf <- randomForest(x=as.data.frame(mfilters[cvtrain,]),
y=as.factor(traingroups),
xtest=as.data.frame(mfilters[cvtest,]),
ytest=as.factor(testgroups))
> x1rf$test$confusion
1 2 3 class.error
1 9954 30 19 0.00489853
2 139 1854 0 0.06974410
3 420 0 84 0.83333333
x1rf <- randomForest(x=as.data.frame(mfilters[cvtrain,]),
y=as.factor(traingroups),
xtest=as.data....
2012 Mar 08
2
Regarding randomForest regression
Sir,
This query is related to randomForest regression using R.
I have a dataset called qsar.arff which I use as my training set and
then I run the following function -
rf=randomForest(x=train,y=trainy,xtest=train,ytest=trainy,ntree=500)
where train is a matrix of predictors without the column to be
predicted(the target column), trainy is the target column.I feed the same
data for xtest and ytest too as shown.
On verifying I found, rf$mse[500] and rf$test$mse[500] are
different(the r-squares are also dif...
2009 Dec 10
2
different randomForest performance for same data
..."datasets.RData") # import traindat and testdat
> nlevels(traindat$predictor1)
[1] 20
> nlevels(testdat$predictor1)
[1] 19
> nrow(traindat)
[1] 9838
> nrow(testdat)
[1] 3841
> set.seed(10)
> rf_orig <- randomForest(x=traindat[,-1], y=traindat[,1], xtest=testdat[,-1], ytest=testdat[,1],ntree=100)
> data.frame(rf_orig$test$err.rate)[100,1] # Error on test-dataset
[1] 0.3082531
# assign the levels of the training dataset th the test dataset for predictor 1
> levels(testdat$predictor1) <- levels(traindat$predictor1)
> nlevels(traindat$predictor1)
[1]...
2009 Apr 04
1
error in trmesh (alphahull package)
...a similar dataset to test against
> length(xcoords)
[1] 26257
> length(ycoords)
[1] 26257
> mean(xcoords)
[1] 670462.4
> mean(ycoords)
[1] 5005382
> sd(xcoords)
[1] 149.3114
> sd(ycoords)
[1] 181.5950
#generate the test data
> xtest<-rnorm(26257,670462.4,149.3)
> ytest<-rnorm(26257,5005382,181.60)
# try ashape routine with success
> alpha.shape<-ashape(xtest,ytest,15)
> class(alpha.shape)
[1] "ashape"
Thanks for any insight into this!
Murray
ps I am able to compute the alpha shapes for this same dataset without
problem using CGAL but...
2006 Jul 26
3
memory problems when combining randomForests
Dear all,
I am trying to train a randomForest using all my control data (12,000 cases, ~
20 explanatory variables, 2 classes). Because of memory constraints, I have
split my data into 7 subsets and trained a randomForest for each, hoping that
using combine() afterwards would solve the memory issue. Unfortunately,
combine() still runs out of memory. Is there anything else I can do? (I am not
using
2012 Dec 03
2
Different results from random.Forest with test option and using predict function
...an code like
this:
set.seed(100)
test1<-randomForest(BinaryY~., data=Xvars, trees=51, mtry=5, seed=200)
predict(test1, newdata=cbind(NewBinaryY, NewXs), type="response")
and this code:
set.seed(100)
test2<-randomForest(BinaryY~., data=Xvars, trees=51, mtry=5, seed=200,
xtest=NewXs, ytest=NewBinarY)
The confusion matrices for the two forests I thought would be the same by
virtue of the same seed settings, but they differ as do the predicted values
as well as the votes. At first I thought it was just the way ties were
broken, so I changed the number of trees to an odd number so the...
2004 Oct 14
0
random forest problem when calculating variable importance
...orest)
set.seed(2863)
x<-matrix(runif(1000),ncol=10)
colnames(x)<-1:10
beta<-matrix(c(1,2,3,4,5,0,0,0,0,0),ncol=1)
y<-drop(x %*% beta + rnorm(100))
newx<-matrix(runif(1000),ncol=10)
newy<-drop(newx %*% beta + rnorm(100))
set.seed(2863)
rf.fit <- randomForest(x=x,y=y,xtest=newx,ytest=newy,importance=F)
print(rf.fit$test$mse[500])
set.seed(2863)
rf.fit <- randomForest(x=x,y=y,xtest=newx,ytest=newy,importance=T)
print(rf.fit$test$mse[500])
2004 Oct 14
0
random forest problem when calculating variable importanc e
...(1000),ncol=10)
> colnames(x)<-1:10
> beta<-matrix(c(1,2,3,4,5,0,0,0,0,0),ncol=1)
> y<-drop(x %*% beta + rnorm(100))
> newx<-matrix(runif(1000),ncol=10)
> newy<-drop(newx %*% beta + rnorm(100))
>
> set.seed(2863)
> rf.fit <- randomForest(x=x,y=y,xtest=newx,ytest=newy,importance=F)
> print(rf.fit$test$mse[500])
>
> set.seed(2863)
> rf.fit <- randomForest(x=x,y=y,xtest=newx,ytest=newy,importance=T)
> print(rf.fit$test$mse[500])
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http...
2005 Oct 11
1
a problem in random forest
Hi, there:
I spent some time on this but I think I really cannot figure it out, maybe I
missed something here:
my data looks like this:
> dim(trn3)
[1] 7361 209
> dim(val3)
[1] 7427 209
> mg.rf2<-randomForest(x=trn3[,1:208], y=trn3[,209], data=trn3, xtest=val3[,
1:208], ytest=val3[,209], importance=T)
my test data has 7427 observations but after prediction,
> dim(mg.rf2$votes)
[1] 7361 2
which has the same length as my training data.
but if I use
mg.rf<-randomForest(x=trn3[,1:208], y=trn3[,209], data=trn3, importance=T)
followed by
> mg.pred<-predict(mg.r...
2009 Sep 15
1
Boost in R
Hello,
does any one know how to interpret this output in R?
> Classification with logitboost
> fit <- logitboost(xlearn, ylearn, xtest, presel=50, mfinal=20)
> summarize(fit, ytest)
Minimal mcr: 0 achieved after 6 boosting step(s)
Fixed mcr: 0 achieved after 20 boosting step(s)
What is "mcr" mean?
Thanks
[[alternative HTML version deleted]]
2010 Aug 16
0
Help for using nnet in R for NN training and testing
...ed the different values into
the matrices to use. Please refer to the code below. I want to use 'xtrain'
and 'ytrain' to train the data (the 60% of the observations) and I want to
simulate the NN with 'xtest' and then compare the predicted Y values from
the NN with the 'ytest' to get a value of MSE.
*****************************************************************************
data<-read.table(file="C:/data.dat",sep=",")
headings<-
c("Class","x1","x2","x3","x4","x5","x6",...
2013 May 06
0
How are feature weights extracted from 'superpc' analysis?
...er, after running
superpc.predict.red, I do not find this value in the output.
The same is true when I run the example script provided in the
documentation, as below:
library(superpc)
set.seed(332)
#generate some data
x<-matrix(rnorm(1000*40),ncol=40)
y<-10+svd(x[1:60,])$v[,1]+ .1*rnorm(40)
ytest<-10+svd(x[1:60,])$v[,1]+ .1*rnorm(40)
censoring.status<- sample(c(rep(1,30),rep(0,10)))
censoring.status.test<- sample(c(rep(1,30),rep(0,10)))
featurenames <- paste("feature",as.character(1:1000),sep="")
data<-list(x=x,y=y, censoring.status=censoring.status,
feat...
2002 Oct 04
1
items in Rd file
...:
\item{err.rate}{final error rate of the prediction on the input data.}
...
For regression problem, the following are included:
\item{mse}{mean square error: sum of squared residuals divided by
\code{n}.}
...
If test set is given (through the \code{xtest} or additionally
\code{ytest} arguments), then there is also a \code{test} component,
which is a list with the following components:
\item{predicted}{predicted classes/values for the test set.}
...
Note: The \code{forest} structure is slightly different between
classification and regression.
===============
In...
2006 Jul 24
2
RandomForest vs. bayes & svm classification performance
...iors and size of training data.
Because I was expecting to see little difference in the perfomance of these
methods I am worried that I may have made a mistake in my randomForest call:
my.rf=randomForest(x=train.df[,-response_index], y=train.df[,response_index],
xtest=test.df[,-response_index], ytest=test.df[,response_index],
importance=TRUE,proximity=FALSE, keep.forest=FALSE)
(where train.df and test.df are my train and test data.frames and response_index
is the column number specifiying the class)
My main question is: could there be a legitimate reason why random forest would
outperform the...
2007 Jan 22
0
Recursive-SVM (R-SVM)
...rainInd <- sample(SampInd, nSample*(CVtype-1)/CVtype )
TestInd <- SampInd[ which(!(SampInd %in% TrainInd ))]
}
}
nTests <- nTests + length(TestInd)
## in each level, train a SVM model and record test error
xTrain <- x[TrainInd, ]
yTrain <- y[TrainInd]
xTest <- x[TestInd,]
yTest <- y[TestInd]
## index of the genes used in the
SelInd <- seq(1, nGene)
for( gLevel in 1:length(ladder) )
{
## record the genes selected in this ladder
SelFreq[SelInd, gLevel] <- SelFreq[SelInd, gLevel] +1
## train SVM model and test error
svmres <- svm(xTrain[, SelInd], yTrain...