Skip to main content

Locally centered contrast functions for scikit-learn FastICA

Project description

icalcc

Locally centered contrast functions for scikit-learn FastICA. Drop-in replacement for sklearn.decomposition.FastICA with bounded LCC-tanh and LCC-exp contrasts, plus polynomial LCC contrasts of order 4, 6, and 8.

from icalcc import ICALCC
ica = ICALCC(n_components=4, K='ltanh', random_state=0)
S_hat = ica.fit_transform(X)

Installation

pip install icalcc

Supported K Values

K Description
'ltanh' Bounded LCC-tanh (robust to heavy tails and skewness)
'lexp' Bounded LCC-exp (maximizes Rényi-2 entropy)
4 Polynomial LCC order 4
6 Polynomial LCC order 6, couples m₃, m₄, m₆
8 Polynomial LCC order 8, couples moments up to order 8
'tanh' Classical logcosh contrast (scikit-learn default)
'exp' Classical Gaussian contrast
'cube' Classical cube contrast ('skew' accepted as alias)

Usage

from icalcc import ICALCC
# Bounded LCC-tanh (recommended for heavy-tailed or skewed sources)
ica = ICALCC(n_components=4, K='ltanh', random_state=0)
S_hat = ica.fit_transform(X)
# Bounded LCC-exp (Rényi-2 entropy interpretation)
ica = ICALCC(n_components=4, K='lexp', random_state=0)
S_hat = ica.fit_transform(X)
# Polynomial LCC order 8 (near-Gaussian sources)
ica = ICALCC(n_components=4, K=8, random_state=0)
S_hat = ica.fit_transform(X)
# Classical FastICA baseline
ica = ICALCC(n_components=4, K='tanh', random_state=0)
S_hat = ica.fit_transform(X)

Convergence tracking

ica.fit(X)
print(ica.converged_)  # True if all components converged

Reconstruction MSE

ica = ICALCC(n_components=3, K='lexp', random_state=0)
ica.fit(X)
mse = ica.reconstruction_mse(X)
print(f"Reconstruction MSE: {mse:.6f}")

reconstruction_mse transforms X to sources and reconstructs via the mixing matrix in the original feature space. Meaningful only in the undercomplete case (n_components < n_features); returns 0.0 exactly when n_components == n_features. Inherited automatically by gpuicalcc.

See Also

Requirements

  • Python ≥ 3.9
  • numpy ≥ 1.24
  • scikit-learn ≥ 1.3

Citation

If you use this package, please cite both the software paper and the underlying LCC kernel paper:

@article{saito2026icalcc,
  author  = {Saito, Tetsuya},
  title   = {{ICALCC}: Locally Centered Contrast Functions for
             {FastICA} with {GPU} Acceleration},
  journal = {TechRxiv},
  year    = {2026},
  doi     = {10.36227/techrxiv.177203264.46969730}
}
@article{saito2026lcc,
  author  = {Saito, Tetsuya},
  title   = {Locally Centered Cyclic Kernels for Higher-Order
             Independent Component Analysis},
  journal = {TechRxiv},
  year    = {2026},
  doi     = {10.36227/techrxiv.177220376.62411390}
}

License

CC BY 4.0

Changelog

0.1.4

  • Added reconstruction_mse(X) method to ICALCC: computes mean squared reconstruction error in the original feature space via inverse_transform. Inherited by GPUICALCC without changes.
  • Renamed contrast 'skew' to 'cube' for clarity; 'skew' is retained as a legacy alias.

0.1.3

  • Initial public release.

Project details


Download files

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

Source Distribution

icalcc-0.1.4.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

icalcc-0.1.4-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file icalcc-0.1.4.tar.gz.

File metadata

  • Download URL: icalcc-0.1.4.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for icalcc-0.1.4.tar.gz
Algorithm Hash digest
SHA256 89a1699f64df6bd736eddf9c34490af9027be15e51b69a7b07455a2d914dd88b
MD5 809892c473ae4fd7b637453c5766d1b2
BLAKE2b-256 429ac2e7bf99c34be4277ae80fda8e940df7ec86aac81a73faa11974632d859c

See more details on using hashes here.

File details

Details for the file icalcc-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: icalcc-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for icalcc-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 df5bbcfb56ac92a3065e6ef061c308c535f8eb4ce4a03b6c34314ffa2f8d3660
MD5 3fe0e218adc67f91a387782aaa8c28d8
BLAKE2b-256 6c07fd165de68fd64718c8d08c1acaaec0cd775aed3c1828b600b056b7c8376e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page