search for: traindata

Displaying 20 results from an estimated 21 matches for "traindata".

2005 Mar 15
1
KNN one factor predicting problem
Could anybody help me out please? > cl<-as.factor(traindata[,13]) > knn(traindata[1:295,2], newdata[1:32,2], cl,k=2, prob=TRUE) Error in knn(traindata[1:295, 2], newdata[1:32, 2], cl, k = m, prob = TRUE) : Dims of test and train differ Both traindata and newdata have 13 elements. Only one of the first 12 elemnets is needed to predict the 13 el...
2009 Aug 04
1
Strange error with ROCR
Hello, I've come across a strange error... Here is what happens: model <- svm(traindata,trainlabels, type="C-classification", kernel="radial", cost=10, class.weights=c("win"=3,"lose"=1), scale=FALSE, probability = TRUE) predictions <- predict(model, traindata) pred <- prediction(predictions, trainlabels) This returns an error: Error i...
2009 Jan 23
1
predict function problem for glmmPQL
Hi all, I am using cross-validation to validate a generalized linear mixed effects model fitted using glmmPQL. i found that the predict function has a problem and i wonder if anyone has encountered the same problem? glmm1 = glmmPQL(y~aX+b,random=~1|sample,data=traindata) predict(glmm1,newdata=testdata,level=1,type="response") gives me all "NA"s. it works for level=0 (the fixed effects), but not for level=1. When i use newdata=traindata, predict function works perfectly. i wonder if this is a problem with predict function or it's some bug...
2020 Jun 05
3
líneas sobre un mapa
...ca la longitud por la que va (de 10º en 10º) pero me gustaría que en vez de eso te fuese representando una línea vertical sobre el mapa, que he representado previamente con ggplot. No es imprescindible, pero quedaría bien. Preds <- data.frame() for (i in seq(from = -180, to = 170, by = 10)){ traindata <- subset(data, lon < i|lon>= i+10) testdata <- subset(data,(lon> i & lon<= i+10)) fitrp <- rpart(Clst ~ .- lon - lat, data=traindata,method = "class") print(i) prd <- predict(fitrp, testdata, type="class") # se aplica el modelo a las muestr...
2011 May 24
1
seeking help on using LARS package
...and interpretable model for siRNA efficacy prediction, Jean-Philippe Vert et. al, Bioinformatics" for a Bioinformatics project that we are working on. I know that the authors of the paper are using Lasso regression and so far looking at their paper this is what I have gotten to. xtrain <- trainData > dim(trainData) [1] 18520 88 ytrain <- trainScore length(ytrain) [1] 18520 nfolds <- 100 epsilon <- exp(-10) # code from JP Vert object1 <- cv.lars(xtrain,ytrain, K=nfolds, fraction = seq(from = 0, to = 1 , length= 1000), type='lasso', eps=epsilon, plot.it=TRUE)...
2006 Mar 23
0
front- end problem while using nnet and tune.nnet
Dear R people, I am using tune.nnet from e1071 package to tune the parameters for nnet. I am using the following syntax: tuneclass <-c(rep(1,46),rep(2,15)) tunennet <-tune.nnet(x=traindata,y=tuneclass,size=c(50,75,100),decay=c(0,0.005,0.010),MaxNWts = 20000) Here traindata is the training data that I want to tune for nnet which is a matrix with 61 rows(samples) and 200 columns(genes). tuneclass is the class indicator vector which says that the first 46 samples of the traindata ar...
2006 Feb 02
0
problem with nnet
...belonging to two classes. 2> I perform samr analysis on 80% of chip data from both the classes.(selected by random sampling) 3> I then use the data of only the significant genes from this samr analysis to train nnet. 4> The parameters I am currently using for nnet are: result <- nnet(traindata[sortsamp,], targets[sortsamp,], size = nnetsize , rang =0.00000003 ,decay = 0.00009, maxit = 100, MaxNWts =100000) traindata is the significant gene's data, sortsamp is the randomly sampled number out of those genes and targets is the class indicator of the significant genes. 5&gt...
2007 Aug 01
1
Predict using SparseM.slm
Hi, I am trying out the SparseM package and had the a question. The following piece of code works fine: ... fit = slm(model, data = trainData, weights = weight) ... But how do I use the fit object to predict the values on say a reserved testDataSet? In the regular lm function I would do something like this: predict.lm(fit,testDataSet) Thanks -Bala _________________________________________________________________________...
2006 Mar 10
1
need help in tune.nnet
Dear R people, I want to use the tune.nnet function of e1071 package to tune nnet . I am unable to understand the parameters of tune.nnet from the e1071 pdf document. I have performed nnet on a traindata and want to test it for class prediction with a testdata. I want to know the values of size,decay,range etc. parameters for which the prediction of testdata is best. Can anyone please tell me how to do this with the tune.nnet function. Anticipating quick response. Thanks and Regards, Madhurima.
2011 May 28
0
how to train ksvm with spectral kernel (kernlab) in caret?
..., I would like to use the train function from the caret package to train a svm with a spectral kernel from the kernlab package. Sadly a svm with spectral kernel is not among the many methods in caret... using caret to train svmRadial: ------------------ library(caret) library(kernlab) data(iris) TrainData<- iris[,1:4] TrainClasses<- iris[,5] set.seed(2) fitControl$summaryFunction<- Rand svmNew<- train(TrainData, TrainClasses, method = "svmRadial", preProcess = c("center", "scale"), metric = "cRand", tuneLength = 4) svmNew ----------------...
2012 Nov 07
5
Calling R object from R function
Hi, Can you please help me with this please? What I am trying to do is call a vector from R function and used in the new function So I create 4 functions with these arguments M11 <- function(TrainData,TestData,mdat,nsam) { ls <- list() I have few statments one of them is vectx <- c(,1,2,3,4,5,6,6) vectz <- c(12,34,5,6,78,9,90) and then................ ls(vectx=vtecx,vectz=vectz) return(ls) } Then I great an new function has the following arguments get.m <- function(dat,asim,ModelF...
2009 Aug 04
1
Save model and predictions from svm
...39;t know how to LOAD the model back in so that I can use it tomorrow. How can I do this? 2) I would like to add the prediction values(confidence) as a column in my original data.frame. (Again, to be used for more analysis at a later date.) I am using "predictions <- prediction(model,traindata)" and that gives me a huge object with all the predictions. Is there a single command that would just add the predictions, or do I need to do some clever data manipulation? Thanks! -N [[alternative HTML version deleted]]
2020 Jun 05
2
líneas sobre un mapa
Buenos días ¿sabéis si hay alguna forma de añadir una recta vertical sobre un mapa hecho previamente con ggplot? Lo que hago ahora es cargar nuevamente el mapa con la línea añadida (una serie de líneas añadidas secuencialmente en un loop) pero me gustaría que añadiese las líneas sin cargar nuevamente el mapa. Gracias, Manuel [[alternative HTML version deleted]]
2020 Apr 01
2
añadir líneas verticales con ggplot
...;green3","darkgreen")) + geom_path( data=world, aes(x=long, y=lat,group=group)) + labs(title = "Trophic Patterns - Full Data")+ guides(colour = guide_legend(override.aes = list(size=5))) después hago un loop con for: for (i in seq(from = -180, to = 170, by = 10)){ traindata <- subset(Data, lon < i|lon>= i+10) testdata <- subset(Data,(lon> i & lon<= i+10)) fitrp <- rpart(Clst ~ .- lon - lat, data=traindata,method = "class", cp=cpopt) print(i) prd <- predict(fitrp, testdata, type="class") # se aplica el modelo a la...
2010 Nov 26
1
Issues with nnet.default for regression/classification
Hi, I'm currently trying desperately to get the nnet function for training a neural network (with one hidden layer) to perform a regression task. So I run it like the following: trainednet <- nnet(x=traindata, y=trainresponse, size = 30, linout = TRUE, maxit=1000) (where x is a matrix and y a numerical vector consisting of the target values for one variable) To see whether the network learnt anything at all, I checked the network weights and those have definitely changed. However, when examining the tr...
2012 May 15
1
caret: Error when using rpart and CV != LOOCV
Hy, I got the following problem when trying to build a rpart model and using everything but LOOCV. Originally, I wanted to used k-fold partitioning, but every partitioning except LOOCV throws the following warning: ---- Warning message: In nominalTrainWorkflow(dat = trainData, info = trainInfo, method = method, : There were missing values in resampled performance measures. ----- Below are some simplified testcases which repoduce the warning on my system. Question: What does this error mean? How can I avoid it? System-Information: ----- > sessionInfo() R version 2....
2009 Aug 25
1
Clogit or LRM?
...ion somewhere. Please see attachment "graph2.pdf" Below is the two step process that I used for the conditional logit. -------------------------------------------------- 1) First a standard logistic regression is calculated on two variables: model <- lrm(label ~ val1 + val2, data = traindata ) This gives me the following results: Coef S.E. Wald Z P Intercept 1.8065 0.05137 35.16 0 val1 0.8105 0.02567 31.57 0 val2 0.5218 0.04308 12.11 0 2) I then calculate a conditional logit: testdata$log_int <- exp( model$coefficients[2] * model$val1 + model$coeffici...
2012 Nov 23
1
caret train and trainControl
I am used to packages like e1071 where you have a tune step and then pass your tunings to train. It seems with caret, tuning and training are both handled by train. I am using train and trainControl to find my hyper parameters like so: MyTrainControl=trainControl( method = "cv", number=5, returnResamp = "all", classProbs = TRUE ) rbfSVM <- train(label~., data =
2013 Mar 06
1
CARET and NNET fail to train a model when the input is high dimensional
The following code fails to train a nnet model in a random dataset using caret: nR <- 700 nCol <- 2000 myCtrl <- trainControl(method="cv", number=3, preProcOptions=NULL, classProbs = TRUE, summaryFunction = twoClassSummary) trX <- data.frame(replicate(nR, rnorm(nCol))) trY <- runif(1)*trX[,1]*trX[,2]^2+runif(1)*trX[,3]/trX[,4] trY <-
2009 Dec 10
2
different randomForest performance for same data
Hello, I came across a problem when building a randomForest model. Maybe someone can help me. I have a training- and a testdataset with a discrete response and ten predictors (numeric and factor variables). The two datasets are similar in terms of number of predictor, name of variables and datatype of variables (factor, numeric) except that only one predictor has got 20 levels in the training