Comments (7)
There is no specific reason, I believe maybe at that point it made sense to keep up with the formula syntax that implicitly includes the intercept and when you evaluate model.matrix
or model.frame
it automatically includes the column of 1s.
Nonetheless, there is another situation that may extend the vector of coefficients to fit when there are factor predictors that internally are broken up between their contrasts, so we actually fit more coefficients that originally present. So all of this should be handled internally of course. I'll write a TODO item to address this more elegantly.
from projpred.
As you noticed at the end, you have to provide a penalty value for the intercept as well. Nonetheless that seems to result in a singular system, maybe because of the penalty added. I would add the intercept penalty to the beginning of the vector, but instead of adding 1 I would add maybe 1e-6, so you don't penalise the intercept but the length matches what the underlying routine expects.
Can you try and report back?
from projpred.
Quickest response ever ;) tried it - it works (here we go)
Out of curiosity: we ran the intercept-less code approx 1 month ago without errors. After the latest brms update (I believe) we encountered the error. Any chance you can elaborate on the internal workings of this?
cvs <- cv_varsel(fit, method = "L1", penalty = c(1e-6, penalty))
``
from projpred.
Great!
In the past month or so we have drastically updated the whole codebase and we always include the intercept now. That means you can fit an intercept-less brms
model (although generally not recommended) but projpred
is still expecting an intercept, which may be the reason why it is now failing if you don't add an explicit penalty term for it. I can probably include it automatically as you call varsel
because the intercept cannot actually be penalised.
from projpred.
Just commenting here that the underlying glm_elnet
function does not expect penalty for the intercept, so the length of the penalty-vector should be equal to the number of columns in x that this function receives. It might be a bug somewhere else. Or did you @AlejandroCatalina introduce penalization also for the intercept in version 2.0?
from projpred.
No, so I didn't mean that we should include penalisation for the intercept. What happens internally is that we introduce the intercept as parameter explicitly, and therefore glm_elnet
believes there are D + 1
coefficients without intercept. That's the reason it's expecting a D + 1
length vector. I will workaround it internally so that the user does not need to indicate anything for the intercept.
from projpred.
Ok, I see. It would also make sense to me that this would happen automatically inside projpred
so that the user wouldn't need to do it. One question though: was there a reason to do it this way (so augmenting the matrix x with column of ones) instead of using the glm_elnet
argument intercept = TRUE
?
from projpred.
Related Issues (20)
- Incompatible with brms when random effects are specified with || syntax HOT 2
- Error from multivariate brms models HOT 6
- Memory issues in multilevel models HOT 2
- Predictive performance gap / jumpy behavior at full size in Gaussian multilevel model HOT 1
- For a stan_glm model cv_varsel with loo works, but kfold gives an error HOT 4
- plot.vsel shows extra xtick label HOT 1
- brmsfit cumulative model & Latent projection predictive feature selection HOT 3
- Convergence checks for additive submodels HOT 4
- Allow dispersion parameter to be observation-specific HOT 1
- Smoothing of cross-validated predictive performance HOT 1
- Add R2 as performance statistic HOT 4
- Error when getting reference model with k-fold cross validation for cv_varsel HOT 9
- Truncated response distributions
- Clarify doc for refit_prj HOT 2
- Don't warn about slightly large khats HOT 1
- Remove QR=TRUE from the vignette
- Guide on latent_ll_oscale for other families e.g. zero-inflated negative binomial, hurdle negbinom HOT 5
- Using projpred in multi-response models with group correlated hierarchical effects HOT 3
- negbin latent projection in latent vignette fails with parallel HOT 1
- Request : Monotonic effect HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from projpred.