Giter Club home page Giter Club logo

Comments (7)

AlejandroCatalina avatar AlejandroCatalina commented on June 11, 2024 1

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.

AlejandroCatalina avatar AlejandroCatalina commented on June 11, 2024

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.

JanaJarecki avatar JanaJarecki commented on June 11, 2024

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.

AlejandroCatalina avatar AlejandroCatalina commented on June 11, 2024

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.

jpiironen avatar jpiironen commented on June 11, 2024

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.

AlejandroCatalina avatar AlejandroCatalina commented on June 11, 2024

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.

jpiironen avatar jpiironen commented on June 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.