Giter Club home page Giter Club logo

Comments (7)

arokem avatar arokem commented on September 16, 2024

Hi @oliver-contier : thanks for reporting. I will investigate, but it might take a little bit of time, because I have some deadlines coming up in the next couple of weeks.

Question, because I am not sure that I understand the use-case: Why would you use ridge regression with only one regressor? Are you sure that X and Y are in the right order here? I'm only asking because the shapes look the opposite of what I'd usually expect.

This should work, or at least provide a useful error.

from fracridge.

oliver-contier avatar oliver-contier commented on September 16, 2024

Hi @arokem,

No hurry, I switched to fracridge.fracridge for now and it seems to work fine. I was using the FracRidgeRegressor object for convenience; I also used its .predict() and .score() methods.

From the documentation and a glance at the code, I gather that the shape of x should be (nsamples, nregressors) and shape of y should be (nsamples, ntargets). And the .fit() method should take .fit(x, y) in that order. So I think the shapes/order should be correct, unless I'm misinterpreting something.

My use-case of only one regressor is only for comparison with a full-fletched model. If this is not how fracridge is supposed to be used, then I guess the issue can be ignored :) Though maybe a different Error/Warning could be provided.

from fracridge.

kendrickkay avatar kendrickkay commented on September 16, 2024

@arokem - it would be nice if the code would run for this (degenerate) case.

Statistically, ridge regularization for the case of one regressor is simply going to scale down the estimated weight for that regressor. This is still meaningful in the sense that the regularization may in fact improve generalization performance (i.e. reduce overfitting).

from fracridge.

arokem avatar arokem commented on September 16, 2024

Yep! That makes sense. I'll fix it up ASAP.

from fracridge.

oliver-contier avatar oliver-contier commented on September 16, 2024

Maybe to motivate my usecase a bit: I'm predicting fmri voxel time series with a parametric modulation model.
Hence the model has one general onset regressor that models the average response to all events, and then there's a bunch of parametric modulators that explain variation around that average response. As a basic sanity check, I wanted to compare the full model's generalization performance to that of a reduced model which has only the average response regressor. In order to have a "fair" comparison, I'm optimizing the regularization parameter for the reduced model as well.

I see how this is may be an edge case and potentially out of the scope of the fracridge package. So if the abovementioned behavior is intended, I understand!

I raised the issue more out of technical confusion, because I ran into the error when using FracRidgeRegressor (and not when using fracridge.fracridge). I think whether users should be discouraged or prevented from using (fractional) ridge regression with only one regressor in the first place might be a different discussion.

Anyway, thanks for both of your comments and creating/maintaining this tremendously useful tool.

from fracridge.

arokem avatar arokem commented on September 16, 2024

I think that this is closed through #25, but let me know if the problem still persists.

from fracridge.

oliver-contier avatar oliver-contier commented on September 16, 2024

Sorry for the delayed response. I gave it a try and it works like a charm. Thanks for digging into this, Cheers!

from fracridge.

Related Issues (17)

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.