similar to: Sparse Matrices and glmnet

Displaying 20 results from an estimated 5000 matches similar to: "Sparse Matrices and glmnet"

2011 Nov 01
1
predict for a cv.glmnet returns an error
Hi there, I am trying to use predict() with an object returned by cv.glmnet(), and get the following error: no applicable method for 'predict' applied to an object of class "cv.glmnet" What's wrong? my code: x=matrix(rnorm(100*20),100,20) y=rnorm(100) cv.fit=cv.glmnet(x,y) predict(cv.fit,newx=x[1:5,]) coef(cv.fit) Thanks so much, Asaf -- View this message in context:
2012 Mar 21
2
glmnet: obtain predictions using predict and also by extracting coefficients
All, For my understanding, I wanted to see if I can get glmnet predictions using both the predict function and also by multiplying coefficients by the variable matrix. This is not worked out. Could anyone suggest where I am going wrong? I understand that I may not have the mean/intercept correct, but the scaling is also off, which suggests a bigger mistake. Thanks for your help. Juliet Hannah
2015 Mar 19
0
RFC: Matrix package: Matrix products (%*%, crossprod, tcrossprod) involving "nsparseMatrix" aka sparse pattern matrices
Hi Martin I got stung by this last week. glmnet produces a coefficient matrix of class ?dgCMatrix? If a predictor matrix was created using sparseMatrix as follows, one gets unexpected results, as this simple example shows. My fix was easy (I always convert the predictor matrix to class ?dgCMatrix? now) Trevor > y=Matrix(diag(4)) > y 4 x 4 diagonal matrix of class "ddiMatrix"
2008 Dec 17
1
glmnet : Error in validObject(.Object) :
Could any one help ? I start to learn the glmnet package. I tried with the example in the manual. x=matrix(rnorm(100*20),100,20) y=rnorm(100) fit1=glmnet(x,y) When I tried to fit the model, I received the error message: Error in validObject(.Object) : invalid class "dgCMatrix" object: row indices are not sorted within columns Thank you very much!
2010 May 03
0
Labels in GLMNET
In the ESL(2) (by F-H-T), they have labels on their Lasso graphs (specifically for the South African Heart Disease data). So my question is, how do I label each variable in a similar way on my graph. The following code should produce a plot with 9 enumerated variables: library(glmnet) x=matrix(rnorm(100*9),100,9) y=rnorm(100) g2=sample(1:2,100,replace=TRUE)
2015 Feb 09
0
Proper way to define cbind, rbind for s4 classes in package
Hi Michael, I've tested your change in r67699 (using r67773) and the function now correctly dispatches to r/cbind2 within the R-session without bind_activation(TRUE). However, running unit tests using R CMD check I figured out that the same function call delegates to r/cbind.matrix (function uses S4 class as first- and matrix as second argument). Is this a bug and/or how can I get function
2015 Feb 11
0
Proper way to define cbind, rbind for s4 classes in package
sorry - I just got irritated by my different R-versions. The behaviour I described in the previous mail was discovered using R 3.1.2 without bind_activation(TRUE). In r67773 all calls are delegated to r/cbind.matrix and not r/cbind2. As a workaround I have now implemented an S3 method for my S4 class which correctly dispatches for both versions (3.1.2 and r67699+) - see also the commit for the h5
2015 Feb 20
1
Proper way to define cbind, rbind for s4 classes in package
>>>>> Mario Annau <mario.annau at gmail.com> >>>>> on Wed, 11 Feb 2015 20:18:53 +0100 writes: > sorry - I just got irritated by my different R-versions. > The behaviour I described in the previous mail was discovered using R > 3.1.2 without bind_activation(TRUE). In r67773 all calls are delegated > to r/cbind.matrix and not
2015 Feb 02
2
Proper way to define cbind, rbind for s4 classes in package
>>>>> Michael Lawrence <lawrence.michael at gene.com> >>>>> on Sun, 1 Feb 2015 19:23:06 -0800 writes: > I've implemented the proposed changes in > R-devel. Minimally tested, so please try it. It should > delegate to r/cbind2 when there is at least one S4 > argument and S3 dispatch fails (so you'll probably want to
2015 Feb 09
2
Proper way to define cbind, rbind for s4 classes in package
Are you able to create a reproducible example, somehow? Thanks, Michael On Mon, Feb 9, 2015 at 2:28 PM, Mario Annau <mario.annau at gmail.com> wrote: > Hi Michael, > I've tested your change in r67699 (using r67773) and the function now > correctly dispatches to r/cbind2 within the R-session without > bind_activation(TRUE). However, running unit tests using R CMD check I
2015 Mar 20
0
RFC: Matrix package: Matrix products (%*%, crossprod, tcrossprod) involving "nsparseMatrix" aka sparse pattern matrices
Hi Martin, package arules heavily relies on ngCMatrix and uses multiplication and addition for logical operations. I think it makes sense that in a mixed operation with one dgCMatrix and one ngCMatrix the ngCMatrix should be "promoted" to a dgCMatrix. The current behavior of %*% and friends is in deed confusing: > m <- matrix(sample(c(0,1), 5*5, replace=TRUE), nrow=5) >
2012 Jan 02
1
calibration curve for glmnet object
Hi, I created a logistic regression model using the glmnet package. This model is of class "glmnet" or "lognet". I wanted to plot a calibration curve for this model using the calibrate() function from rms package, but the objects used are different, rms requires a fit from lrm(). Is there another function for getting the calibration plot for this glmnet object, or can anyone
2010 Jan 25
0
glmnet in caret packge
Dear all, I want to train my model with LASSO using caret package (glmnet). So, in glmnet, there are two parameters, alpha and lambda. How can I fix my alpha=1 to get a lasso model? con<-trainControl(method="cv",number=10) model <- train(X, y, "glmnet", metric="RMSE",tuneLength = 10, trControl = con) Thanks Alex Roy [[alternative HTML
2011 Jun 23
1
gcc-4.5.2 and install.packages("glmnet")?
Hi, is there any chance to install glmnet with gcc-4.5.2? For me it fails on all systems with: trying URL 'http://mirrors.softliste.de/cran/src/contrib/glmnet_1.7.tar.gz' Content type 'application/x-gzip' length 522888 bytes (510 Kb) opened URL ================================================== downloaded 510 Kb * installing *source* package ?glmnet? ... This package has only
2012 May 07
1
estimating survival times with glmnet and coxph
Dear all, I am using glmnet (Coxnet) for building a Cox Model and to make actual prediction, i.e. to estimate the survival function S(t,Xn) for a new subject Xn. If I am not mistaken, glmnet (coxnet) returns beta, beta*X and exp(beta*X), which on its own cannot generate S(t,Xn). We miss baseline survival function So(t). Below is my code which takes beta coefficients from glmnet and creates coxph
2009 Mar 17
1
- help - predicting with glmnet/lars for dataframes with different nrow then the train set
Hello I'm having trouble using lars and glmnet functions to predict on a new data set with different nrow then the original : for instance: ============= log.1 = glm(temp.data$TL~(.),temp.data,family = binomial,x=TRUE,y=TRUE) nrow(test.data) != nrow(temp.data # == TRUE Val.frame = model.frame(log.1,test.data) # returns a data frame with the variables needed to use log.1
2011 Oct 06
0
linear classifiers with sparse matrices
I've been trying to get some linear classifiers (LiblineaR, kernlab, e1071) to work with a sparse matrix of feature data. In the case of LiblineaR and kernlab, it seems I have to coerce my data into a dense matrix in order to train a model. I've done a number of searches, read through the manuals and vignettes, but I can't seem to see how to use either of these packages with sparse
2013 Jun 11
1
Caret train with glmnet give me Error "arguments imply differing number of rows"
Hello, I'm training a set of data with Caret package using an elastic net (glmnet). Most of the time train works ok, but when the data set grows in size I get the following error: Error en { : task 1 failed - "arguments imply differing number of rows: 9, 10" and several warnings like this one: 1: In eval(expr, envir, enclos) : model fit failed for Resample01 My call to train
2012 Feb 10
1
Choosing glmnet lambda values via caret
Usually when using raw glmnet I let the implementation choose the lambdas. However when training via caret::train the lambda values are predetermined. Is there any way to have caret defer the lambda choices to caret::train and thus choose the optimal lambda dynamically? -- Yang Zhang http://yz.mit.edu/
2023 Oct 24
1
running crossvalidation many times MSE for Lasso regression
?s 20:12 de 23/10/2023, varin sacha via R-help escreveu: > Dear R-experts, > > I really thank you all a lot for your responses. So, here is the error (and warning) messages at the end of my R code. > > Many thanks for your help. > > > Error in UseMethod("predict") : > ? no applicable method for 'predict' applied to an object of class