Multi-Task Regression in Python
Project description
MuTaR is a collection of sparse models for multi-task regression. Mutar models fit regularized regression on a sequence of related linear models (X_1, y_1) … (X_k, y_k) and follows scikit-learn’s API. Compared with scikit-learn’s MultiTaskLasso, MuTaR allows for a different design data X for each task.
Mutar models include:
- Independent linear models:
Independent Lasso estimator
Independent Re-weighted (Adaptive) Lasso estimator
- Group-norms multi-task linear models:
GroupLasso: The Group Lasso is an l1/l2 regularized regression with identical feature supports across tasks (Yuan and Lin, J. R Statistical Society 2006).
DirtyModel: Dirty models are a generalization of the Group Lasso with a partial overlap of features. They are defined using a composite l1/l2 and l1 regularization (Jalali et al., NeurIPS 2010).
MultiLevelLasso : Multilevel Lasso is a non-convex model that enhances further sparsity and encourages partial overlap with a product decomposition (Lozano and Swirszcz, ICML 2012).
- Optimal transport regularized models:
MTW: Multi-task Wasserstein is a sparse regression model where relevant features across tasks are close according to some defined geometry. (Janati et al., AISTATS 2019).
ReMTW: Reweighted MTW is a non-convex variant of MTW that promotes even more sparsity and reduces the amplitude bias caused by the L1 norm. Both models are implemented with a concomitant argument for inferring the standard deviation of each task and adapting the amount of regularization accordingly.
Installation
To install the last release of MuTaR:
pip install -U mutar
To get the current development version:
git clone https://github.com/hichamjanati/mutar cd mutar python setup.py develop
We recommend creating this minimal conda env
conda env create --file environment.yml conda activate mutar-env git clone https://github.com/hichamjanati/mutar cd mutar python setup.py develop
Example
>>> import numpy as np
>>> from mutar import GroupLasso
>>> # create some X (n_tasks, n_samples, n_features)
>>> X = np.array([[[3., 1.], [2., 0.]], [[0., 2.], [-1., 3.]]])
>>> print(X.shape)
(2, 2, 2)
>>> # and target y (n_tasks, n_samples)
>>> y = np.array([[-3., 1.], [1., -2.]])
>>> print(y.shape)
(2, 2)
>>> gl = GroupLasso(alpha=1.)
>>> coef = gl.fit(X, y).coef_
>>> print(coef.shape)
(2, 2)
>>> # coefficients (n_features, n_tasks)
>>> # share the same support
>>> print(coef)
[[-0.8 0.6]
[-0. -0. ]]
Documentation
See the doc and use examples at the MuTaR webpage.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file mutar-0.0.1.tar.gz
.
File metadata
- Download URL: mutar-0.0.1.tar.gz
- Upload date:
- Size: 278.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 951744ff05f102f979f3290faceed9062fe8a333ade2ac9c7d7c56337ec4e4a9 |
|
MD5 | d77fc29f42c641bc462b5cf31c82ea68 |
|
BLAKE2b-256 | fd1f1133823b313eba87c8de24b76c318858821bd22cc3f45e0949fe48f8d19a |
File details
Details for the file mutar-0.0.1-py3.6.egg
.
File metadata
- Download URL: mutar-0.0.1-py3.6.egg
- Upload date:
- Size: 19.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c23cd4e3ee289c1c976004df3de957f777848d34874ad660e3eacba84dc689a |
|
MD5 | 172b5ce20c117006b7970a3392eb1eee |
|
BLAKE2b-256 | f34973fcd42ab4a8242411d43c9599acd1c09cd447a130e9892790a557245b6e |
File details
Details for the file mutar-0.0.1-cp36-cp36m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: mutar-0.0.1-cp36-cp36m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 100.3 kB
- Tags: CPython 3.6m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 585006421339dc5f546fc51745cf919aad8ade0410bbfbca23cc49172e8205e4 |
|
MD5 | d051e25e99b5e74081076729d820424e |
|
BLAKE2b-256 | e4fee47fa097c15246cb10adfc55b69d6788e9e6f46fb4c34ac58e9b55634b26 |