Git Product home page Git Product logo

mtw's Introduction

Travis AppVeyor Codecov CircleCI ReadTheDocs

Documentation

Detailed examples can be found here.

Multi-task Wasserstein (mtw)

Wasserestein regularization for sparse Multi-task regression.

Given high dimensional regression datasets (X^t, y^t) t = 1..T , MTW solves the optimization problem:

eq1

where:

eq2

with

eq3

where W is the Unbalanced KL Wasserstein distance.

Install the development version

From a console or terminal clone the repository and install MTW:

git clone https://github.com/hichamjanati/mtw.git
cd mtw/
conda env create --file environment.yml
source activate mtw-env
pip install --no-deps -e .

Demos & Examples

Given a ground metric M and the entropy parameter that define the Wasserstein metric, an MTW object can be created and fitted on multi-task regression data (X, y). Where the shapes of X and Y are (n_tasks, n_samples, n_features) and (n_tasks, n_samples)

>>> from mtw import MTW
>>> n_tasks, n_samples, n_features = 2, 10, 50
>>> # Compute M as Euclidean distances matrix if not given
>>> grid = np.arange(n_features)
>>> M = (grid[:, None] - grid[None, :]) ** 2
>>> # Some data X and y
>>> X = np.random.randn(n_tasks, n_samples, n_features)
>>> y = np.random.randn(n_tasks, n_samples)
>>> epsilon = 1. / n_features
>>> alpha = 0.1
>>> beta = 0.1
>>> mtw = MTW(alpha=alpha, beta=beta, M=M, epsilon=epsilon)
>>> mtw = mtw.fit(X, y)
>>> coefs = mtw.coefs_

A concomittant version where the standard deviation of each task is inferred. The lower bound on sigma can be set via the sigma0 parameter of MTW. The following example sets this lower bound to 1% of the initial std estimation np.std(Y).

>>> from mtw import MTW
>>> n_tasks, n_samples, n_features = 2, 10, 50
>>> grid = np.arange(n_features)
>>> M = (grid[:, None] - grid[None, :]) ** 2
>>> # Some data X and y
>>> X = np.random.randn(n_tasks, n_samples, n_features)
>>> y = np.random.randn(n_tasks, n_samples)
>>> epsilon = 1. / n_features
>>> alpha = 0.1
>>> beta = 0.1
>>> sigma0 = 0.01
>>> mtw = MTW(alpha=alpha, beta=beta, M=M, epsilon=epsilon, sigma0=sigma0)

See the Documentation for details.

Dependencies

All dependencies are in ./environment.yml

Cite

If you use this code, please cite:

@InProceedings{janati19a,
author={Hicham Janati and Marco Cuturi and Alexandre Gramfort},
title={Wasserstein regularization for sparse multi-task regression},
booktitle = {Proceedings of the Twenty-second International Conference on Artificial Intelligence and Statistics},
year =       {2019},
volume =     {89},
series =     {Proceedings of Machine Learning Research},
month =      {16--19 Apr},
publisher =          {PMLR},
}

ArXiv link: https://arxiv.org/abs/1805.07833

If you use the concomittant version of MTW, please cite:

@InProceedings{janati19b,
author={Hicham Janati and Thomas Bazeille and Bertrand Thirion and Marco Cuturi and Alexandre Gramfort},
title={Group level M-EEG source imaging via Optimal transport: Minimum Wasserstein Estimates},
booktitle = {Proceedings of the Fifty-th Conference on Information Processing and Medical Imaging},
year =       {2019},
month =      {02--07 June},
publisher =          {Springer},
}

mtw's People

Contributors

massich avatar

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.