python-picard


Namepython-picard JSON
Version 0.7 PyPI version JSON
download
home_pagehttps://pierreablin.github.io/picard
SummaryPreconditoned ICA for Real Data
upload_time2021-10-20 15:06:51
maintainerPierre Ablin
docs_urlNone
author
requires_python>=3.7
licenseBSD (3-clause)
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Picard : Preconditioned ICA for Real Data
=========================================

|GHActions|_ |PyPI|_ |Codecov|_ |Downloads|_

.. |GHActions| image:: https://github.com/pierreablin/picard/workflows/unittests/badge.svg?branch=master&event=push
.. _GHActions: https://github.com/pierreablin/picard/actions

.. |Codecov| image:: http://codecov.io/github/pierreablin/picard/coverage.svg?branch=master
.. _Codecov: http://codecov.io/github/pierreablin/picard?branch=master

.. |PyPI| image:: https://badge.fury.io/py/python-picard.svg
.. _PyPI: https://badge.fury.io/py/python-picard

.. |Downloads| image:: http://pepy.tech/badge/python-picard
.. _Downloads: http://pepy.tech/project/python-picard

This repository hosts Python/Octave/Matlab code of the Preconditioned ICA
for Real Data (Picard) and Picard-O algorithms.

See the `documentation <https://pierreablin.github.io/picard/index.html>`_.

Algorithm
---------

Picard is an algorithm for maximum likelihood independent component analysis.
It shows state of the art speed of convergence, and solves the same problems as the widely used FastICA, Infomax and extended-Infomax, faster.

.. image:: comparison.png
  :scale: 50 %
  :alt: Comparison
  :align: center

The parameter `ortho` choses whether to work under orthogonal constraint (i.e. enforce the decorrelation of the output) or not.
It also comes with an extended version just like extended-infomax, which makes separation of both sub and super-Gaussian signals possible.
It is chosen with the parameter `extended`.

* `ortho=False, extended=False`: same solution as Infomax
* `ortho=False, extended=True`: same solution as extended-Infomax
* `ortho=True, extended=True`: same solution as FastICA
* `ortho=True, extended=False`: finds the same solutions as Infomax under orthogonal constraint.




Installation
------------

We recommend the `Anaconda Python distribution <https://www.continuum.io/downloads>`_.


conda
~~~~~

Picard can be installed with `conda-forge <https://conda-forge.org/docs/user/introduction.html>`_.
You need to add `conda-forge` to your conda channels, and then do::

  $ conda install python-picard


pip
~~~

Otherwise, to install ``picard``, you first need to install its dependencies::

	$ pip install numpy matplotlib numexpr scipy

Then install Picard with pip::

	$ pip install python-picard

or to get the latest version of the code::

  $ pip install git+https://github.com/pierreablin/picard.git#egg=picard

If you do not have admin privileges on the computer, use the ``--user`` flag
with `pip`. To upgrade, use the ``--upgrade`` flag provided by `pip`.


check
~~~~~

To check if everything worked fine, you can do::

	$ python -c 'import picard'

and it should not give any error message.


matlab/octave
~~~~~~~~~~~~~

The Matlab/Octave version of Picard and Picard-O is `available here <https://github.com/pierreablin/picard/tree/master/matlab_octave>`_.

Quickstart
----------

To get started, you can build a synthetic mixed signals matrix:

.. code:: python

   >>> import numpy as np
   >>> N, T = 3, 1000
   >>> S = np.random.laplace(size=(N, T))
   >>> A = np.random.randn(N, N)
   >>> X = np.dot(A, S)

And then use Picard to separate the signals:

.. code:: python

   >>> from picard import picard
   >>> K, W, Y = picard(X)

Picard outputs the whitening matrix, K, the estimated unmixing matrix, W, and
the estimated sources Y. It means that Y = WKX

NEW: scikit-learn compatible API
--------------------------------

Introducing `picard.Picard`, which mimics `sklearn.decomposition.FastICA` behavior:

.. code:: python

    >>> from sklearn.datasets import load_digits
    >>> from picard import Picard
    >>> X, _ = load_digits(return_X_y=True)
    >>> transformer = Picard(n_components=7)
    >>> X_transformed = transformer.fit_transform(X)
    >>> X_transformed.shape


Dependencies
------------

These are the dependencies to use Picard:

* numpy (>=1.8)
* matplotlib (>=1.3)
* numexpr (>= 2.0)
* scipy (>=0.19)


These are the dependencies to run the EEG example:

* mne (>=0.14)

Cite
----

If you use this code in your project, please cite::

    Pierre Ablin, Jean-Francois Cardoso, Alexandre Gramfort
    Faster independent component analysis by preconditioning with Hessian approximations
    IEEE Transactions on Signal Processing, 2018
    https://arxiv.org/abs/1706.08171

    Pierre Ablin, Jean-François Cardoso, Alexandre Gramfort
    Faster ICA under orthogonal constraint
    ICASSP, 2018
    https://arxiv.org/abs/1711.10873



            

Raw data

            {
    "_id": null,
    "home_page": "https://pierreablin.github.io/picard",
    "name": "python-picard",
    "maintainer": "Pierre Ablin",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "pierre.ablin@inria.fr",
    "keywords": "",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/5b/7f/9ef17f3c733f517f213a5b30dc8fc3d7d7161f6d9475c748a3cce2504bef/python-picard-0.7.tar.gz",
    "platform": "any",
    "description": "Picard : Preconditioned ICA for Real Data\n=========================================\n\n|GHActions|_ |PyPI|_ |Codecov|_ |Downloads|_\n\n.. |GHActions| image:: https://github.com/pierreablin/picard/workflows/unittests/badge.svg?branch=master&event=push\n.. _GHActions: https://github.com/pierreablin/picard/actions\n\n.. |Codecov| image:: http://codecov.io/github/pierreablin/picard/coverage.svg?branch=master\n.. _Codecov: http://codecov.io/github/pierreablin/picard?branch=master\n\n.. |PyPI| image:: https://badge.fury.io/py/python-picard.svg\n.. _PyPI: https://badge.fury.io/py/python-picard\n\n.. |Downloads| image:: http://pepy.tech/badge/python-picard\n.. _Downloads: http://pepy.tech/project/python-picard\n\nThis repository hosts Python/Octave/Matlab code of the Preconditioned ICA\nfor Real Data (Picard) and Picard-O algorithms.\n\nSee the `documentation <https://pierreablin.github.io/picard/index.html>`_.\n\nAlgorithm\n---------\n\nPicard is an algorithm for maximum likelihood independent component analysis.\nIt shows state of the art speed of convergence, and solves the same problems as the widely used FastICA, Infomax and extended-Infomax, faster.\n\n.. image:: comparison.png\n  :scale: 50 %\n  :alt: Comparison\n  :align: center\n\nThe parameter `ortho` choses whether to work under orthogonal constraint (i.e. enforce the decorrelation of the output) or not.\nIt also comes with an extended version just like extended-infomax, which makes separation of both sub and super-Gaussian signals possible.\nIt is chosen with the parameter `extended`.\n\n* `ortho=False, extended=False`: same solution as Infomax\n* `ortho=False, extended=True`: same solution as extended-Infomax\n* `ortho=True, extended=True`: same solution as FastICA\n* `ortho=True, extended=False`: finds the same solutions as Infomax under orthogonal constraint.\n\n\n\n\nInstallation\n------------\n\nWe recommend the `Anaconda Python distribution <https://www.continuum.io/downloads>`_.\n\n\nconda\n~~~~~\n\nPicard can be installed with `conda-forge <https://conda-forge.org/docs/user/introduction.html>`_.\nYou need to add `conda-forge` to your conda channels, and then do::\n\n  $ conda install python-picard\n\n\npip\n~~~\n\nOtherwise, to install ``picard``, you first need to install its dependencies::\n\n\t$ pip install numpy matplotlib numexpr scipy\n\nThen install Picard with pip::\n\n\t$ pip install python-picard\n\nor to get the latest version of the code::\n\n  $ pip install git+https://github.com/pierreablin/picard.git#egg=picard\n\nIf you do not have admin privileges on the computer, use the ``--user`` flag\nwith `pip`. To upgrade, use the ``--upgrade`` flag provided by `pip`.\n\n\ncheck\n~~~~~\n\nTo check if everything worked fine, you can do::\n\n\t$ python -c 'import picard'\n\nand it should not give any error message.\n\n\nmatlab/octave\n~~~~~~~~~~~~~\n\nThe Matlab/Octave version of Picard and Picard-O is `available here <https://github.com/pierreablin/picard/tree/master/matlab_octave>`_.\n\nQuickstart\n----------\n\nTo get started, you can build a synthetic mixed signals matrix:\n\n.. code:: python\n\n   >>> import numpy as np\n   >>> N, T = 3, 1000\n   >>> S = np.random.laplace(size=(N, T))\n   >>> A = np.random.randn(N, N)\n   >>> X = np.dot(A, S)\n\nAnd then use Picard to separate the signals:\n\n.. code:: python\n\n   >>> from picard import picard\n   >>> K, W, Y = picard(X)\n\nPicard outputs the whitening matrix, K, the estimated unmixing matrix, W, and\nthe estimated sources Y. It means that Y = WKX\n\nNEW: scikit-learn compatible API\n--------------------------------\n\nIntroducing `picard.Picard`, which mimics `sklearn.decomposition.FastICA` behavior:\n\n.. code:: python\n\n    >>> from sklearn.datasets import load_digits\n    >>> from picard import Picard\n    >>> X, _ = load_digits(return_X_y=True)\n    >>> transformer = Picard(n_components=7)\n    >>> X_transformed = transformer.fit_transform(X)\n    >>> X_transformed.shape\n\n\nDependencies\n------------\n\nThese are the dependencies to use Picard:\n\n* numpy (>=1.8)\n* matplotlib (>=1.3)\n* numexpr (>= 2.0)\n* scipy (>=0.19)\n\n\nThese are the dependencies to run the EEG example:\n\n* mne (>=0.14)\n\nCite\n----\n\nIf you use this code in your project, please cite::\n\n    Pierre Ablin, Jean-Francois Cardoso, Alexandre Gramfort\n    Faster independent component analysis by preconditioning with Hessian approximations\n    IEEE Transactions on Signal Processing, 2018\n    https://arxiv.org/abs/1706.08171\n\n    Pierre Ablin, Jean-Fran\u00e7ois Cardoso, Alexandre Gramfort\n    Faster ICA under orthogonal constraint\n    ICASSP, 2018\n    https://arxiv.org/abs/1711.10873\n\n\n",
    "bugtrack_url": null,
    "license": "BSD (3-clause)",
    "summary": "Preconditoned ICA for Real Data",
    "version": "0.7",
    "project_urls": {
        "Download": "https://github.com/pierreablin/picard.git",
        "Homepage": "https://pierreablin.github.io/picard"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5feb9de3b1ad3712700abb702b6ea6590caeeab1bc3bda08d31785121bde159f",
                "md5": "0b51c9899cf13dd5fd162245037d0766",
                "sha256": "52643e2d644d9317559da3f3a26eb3661bbd813dd7a7061d39f7084618c8c938"
            },
            "downloads": -1,
            "filename": "python_picard-0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0b51c9899cf13dd5fd162245037d0766",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 16105,
            "upload_time": "2021-10-20T15:06:50",
            "upload_time_iso_8601": "2021-10-20T15:06:50.232883Z",
            "url": "https://files.pythonhosted.org/packages/5f/eb/9de3b1ad3712700abb702b6ea6590caeeab1bc3bda08d31785121bde159f/python_picard-0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5b7f9ef17f3c733f517f213a5b30dc8fc3d7d7161f6d9475c748a3cce2504bef",
                "md5": "4adab7a57a5c584e6fbbfb39841e0213",
                "sha256": "8061a1f0c4660c805b7617f2f0bd0284c6e6e84ac3ec782081c67b27cfd185a7"
            },
            "downloads": -1,
            "filename": "python-picard-0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "4adab7a57a5c584e6fbbfb39841e0213",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 63154,
            "upload_time": "2021-10-20T15:06:51",
            "upload_time_iso_8601": "2021-10-20T15:06:51.818549Z",
            "url": "https://files.pythonhosted.org/packages/5b/7f/9ef17f3c733f517f213a5b30dc8fc3d7d7161f6d9475c748a3cce2504bef/python-picard-0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-10-20 15:06:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pierreablin",
    "github_project": "picard",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "circle": true,
    "requirements": [],
    "lcname": "python-picard"
}
        
Elapsed time: 0.10540s