Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Group Lasso package for Python

Project description

Group Lasso package for Python.

## Installation Guide

### Using pip

The easiest way to install GroupLasso is using pip

` pip install GroupLasso `

### Building from source

Run the following commands:

` git clone cd GroupLasso python install `

## Getting started Here is the GroupLassoRegressor model:

`python from grouplasso import GroupLassoRegressor `

Create sample dataset: `python import numpy as np np.random.seed(0) X = np.random.randn(10, 3) # target variable is strongly correlated with 0th feature. y = X[:, 0] + np.random.randn(10) * 0.1 `

Set group_ids, which specify group membership: `python # 0th feature and 1st feature are the same group. group_ids = np.array([0, 0, 1]) `

You can now train Group Lasso: `python model = GroupLassoRegressor(group_ids=group_ids, random_state=42, verbose=False, alpha=1e-1), y) `

Note that all the members of a particular group are either selected(coef_ != 0) or not selected(coef_ == 0). `python model.coef_ # array([ 0.84795715, -0.01193528, -0.        ]) `

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for GroupLasso, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size GroupLasso-0.2.0.tar.gz (5.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page