This is a library to run the Preconditioned ICA for Real Data (PICARD) algorithm  and its orthogonal version (PICARD-O) . These algorithms show fast convergence even on real data for which sources independence do not perfectly hold.
We recommend the Anaconda Python distribution.
Picard can be installed with conda-forge. You need to add conda-forge to your conda channels, and then do:
$ conda install python-picard
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
If you do not have admin privileges on the computer, use the
with pip. To upgrade, use the
--upgrade flag provided by pip.
To check if everything worked fine, you can do:
$ python -c 'import picard'
and it should not give any error message.
The easiest way to get started is to copy the following lines of code in your script:
>>> import numpy as np >>> from picard import picard >>> N, T = 3, 1000 >>> S = np.random.laplace(size=(N, T)) >>> A = np.random.randn(N, N) >>> X = np.dot(A, S) >>> K, W, Y = picard(X)
Picard outputs the whitening matrix, K, the estimated unmixing matrix, W, and the estimated sources Y. It means that:
Introducing picard.Picard, which mimics sklearn.decomposition.FastICA behavior:
>>> 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
These are the dependencies to use Picard:
numexpr (>= 2.0)
These are the dependencies to run the EEG example:
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
Use the github issue tracker to report bugs.