Code Monkey home page Code Monkey logo

Comments (4)

mblondel avatar mblondel commented on July 21, 2024

It's only supported for multiclass classification and multitask classification / regression. The groups are the weights of a feature in all classes / tasks. This question comes up all the time. We need to improve the documentation.

from lightning.

zht012323 avatar zht012323 commented on July 21, 2024

May i know this problem have been solved ? It is not clear to distinguish the group which have the same group penalty.In another word,in lamda*sum(sqrt(p))||beta||_2^2 , in CDClassifier which paremeter is defined each group size p.thanks

from lightning.

fabianp avatar fabianp commented on July 21, 2024

@zht012323 there hasn't been any progress on this

from lightning.

8bit-pixies avatar 8bit-pixies commented on July 21, 2024

Would defining a custom penalty and using FISTA partially "solve" this problem by basically rolling our own custom penalty?

Not sure if my "group penalty" actually makes sense in this context, but suppose we have two groups of coefficients off a dataset with 40 coefficients. One group being the first 20 indices, and the 2nd group being the second 20 indices.

Would one way to do Group Lasso be to define the penalty as:

class L1Penalty1(object):
    def __init__(self, group=[]):
        self.group = group
        
    def projection(self, coef, alpha, L):
        #np.sign(coef) * np.maximum(np.abs(coef) - alpha / L, 0)
        coef_group = coef.flatten().copy()
        for gp in self.group:
            gp_ = np.sum(np.abs(coef_group[gp]))
            coef_group[gp] = gp_
        coef_group = (coef_group/np.sum(coef_group)) * coef_group.shape[0]
        coef_group = coef_group.reshape(1, -1)
        #print(coef_group)
        #print(np.sum(coef_group))
        #print("---\n")
        
        reg_ = np.sum(np.abs(coef))
        projl1_ = np.sign(coef) * np.maximum(np.abs(coef) - alpha / L, 0) * coef_group
        return projl1_* (reg_/np.sum(np.abs(projl1_)))

    def regularization(self, coef):
        return np.sum(np.abs(coef))

Would this work?

from lightning.

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.