Skip to main content

nGene FastICA

A lightweight, heavily annotated FastICA implementation for educational signal separation and local waveform separation demos.

This package keeps the FastICA engine simple and local. Version 0.1.2 restores and expands the human-readable explanatory comments around the core algorithm so that the code can be studied as an educational implementation, not only used as a black-box function.

What this package does

Fast Independent Component Analysis (FastICA) separates observed mixed signals into estimated independent source components. Typical examples include synthetic waveform separation, auditory signal demos, and educational blind-source-separation experiments.

Input shape convention:

(n_signals, n_samples)

Rows are observed mixtures and columns are sample points.

Install locally during development

python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install -e .

Basic usage

import numpy as np
from ngene_fastica import FastICA

# Shape convention: rows are observed mixtures, columns are samples.
X = np.random.randn(3, 10000)
S = FastICA(n_components=3, random_state=42).fit_transform(X)
print(S.shape)

Backward-compatible usage

The original educational script used num_sources, max_iterations, tolerance, and decompose_mixtures(). These names are supported as aliases:

from ngene_fastica import FastICA

ica = FastICA(num_sources=3, max_iterations=500, tolerance=1e-5, random_state=42)
source_signals = ica.decompose_mixtures(signal_mixtures)

Local waveform separation demo

After local installation:

ngene-fastica-demo

The demo writes WAV files for generated sources, mixed signals, and separated signals. ICA recovers sources up to permutation and sign, so the separated files may not match the original source order exactly.

Educational notes in the source code

The core implementation in src/ngene_fastica/fastica.py now includes step-by-step explanatory comments for:

  • input shape convention;
  • centering;
  • covariance estimation;
  • eigenvalue decomposition;
  • whitening;
  • random unmixing-matrix initialization;
  • fixed-point FastICA iteration;
  • tanh non-linearity and derivative;
  • symmetric decorrelation by SVD;
  • sign-invariant convergence;
  • final source extraction through components_.

Notes

  • Input shape is (n_signals, n_samples).
  • The implementation uses NumPy only; SciPy is not required.
  • This is intended as a lightweight educational/demo package, not a replacement for mature scientific packages.
  • ICA output has sign and permutation ambiguity by design.

Metadata

Release files for ngene-fastica 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ngene-fastica 0.1.2
File Size Uploaded
ngene_fastica-0.1.2.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ngene-fastica 0.1.2
File Interpreter ABI Platform
ngene_fastica-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 21.1 kB

Release files / ngene_fastica-0.1.2.tar.gz

Download URL ngene_fastica-0.1.2.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
87baf1733395a39e52104f4715d068d783833cd7c65c6a40e76b461324fb94dc
BLAKE2b-256 checksum
How to use checksums
6669b4e25ca3fd68effdd078e95b8ad44613ecdc86c3b440faf1c50a5b89ade3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / ngene_fastica-0.1.2-py3-none-any.whl

Download URL ngene_fastica-0.1.2-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0f4d3a4e7312faf4d149b975028b7d5fd6fde6757510000e237f57bbaee5bd9
BLAKE2b-256 checksum
How to use checksums
8138ddbadb110cb4cc7e1859bb8cfc7546fe6ca65597111010ea43ba30473534
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page