Class FastICA<T>
- Namespace
- AiDotNet.Preprocessing.DimensionalityReduction
- Assembly
- AiDotNet.dll
Fast Independent Component Analysis (FastICA) for blind source separation.
public class FastICA<T> : TransformerBase<T, Matrix<T>, Matrix<T>>, IDataTransformer<T, Matrix<T>, Matrix<T>>
Type Parameters
TThe numeric type for calculations (e.g., float, double).
- Inheritance
-
FastICA<T>
- Implements
- Inherited Members
Remarks
FastICA separates a multivariate signal into additive, independent non-Gaussian components. It is commonly used for blind source separation (e.g., separating mixed audio signals) and feature extraction.
The algorithm: 1. Centers and whitens the data 2. Uses fixed-point iteration to find independent components 3. Each component is found by maximizing non-Gaussianity
For Beginners: Imagine you have recordings from multiple microphones in a room with multiple speakers. ICA can separate the individual speakers: - It finds components that are statistically independent - Unlike PCA which finds uncorrelated components, ICA finds truly independent ones - Works best when source signals are non-Gaussian (most real-world signals are)
Constructors
FastICA(int, ICAAlgorithm, ICAFunction, int, double, bool, int, int[]?)
Creates a new instance of FastICA<T>.
public FastICA(int nComponents = 2, ICAAlgorithm algorithm = ICAAlgorithm.Parallel, ICAFunction fun = ICAFunction.LogCosh, int maxIterations = 200, double tolerance = 0.0001, bool whiten = true, int randomState = 0, int[]? columnIndices = null)
Parameters
nComponentsintNumber of components to extract. Defaults to 2.
algorithmICAAlgorithmAlgorithm: parallel or deflation. Defaults to Parallel.
funICAFunctionNon-linearity function: logcosh, exp, or cube. Defaults to LogCosh.
maxIterationsintMaximum iterations. Defaults to 200.
tolerancedoubleConvergence tolerance. Defaults to 1e-4.
whitenboolWhether to whiten data before ICA. Defaults to true.
randomStateintRandom seed. Defaults to 0.
columnIndicesint[]The column indices to use, or null for all columns.
Properties
Algorithm
Gets the algorithm type (parallel or deflation).
public ICAAlgorithm Algorithm { get; }
Property Value
Components
Gets the unmixing matrix (components).
public double[,]? Components { get; }
Property Value
- double[,]
Fun
Gets the non-linearity function used.
public ICAFunction Fun { get; }
Property Value
Mixing
Gets the mixing matrix.
public double[,]? Mixing { get; }
Property Value
- double[,]
NComponents
Gets the number of independent components.
public int NComponents { get; }
Property Value
SupportsInverseTransform
Gets whether this transformer supports inverse transformation.
public override bool SupportsInverseTransform { get; }
Property Value
Methods
FitCore(Matrix<T>)
Fits FastICA to extract independent components.
protected override void FitCore(Matrix<T> data)
Parameters
dataMatrix<T>The training data matrix.
GetFeatureNamesOut(string[]?)
Gets the output feature names after transformation.
public override string[] GetFeatureNamesOut(string[]? inputFeatureNames = null)
Parameters
inputFeatureNamesstring[]
Returns
- string[]
InverseTransformCore(Matrix<T>)
Transforms independent components back to original space.
protected override Matrix<T> InverseTransformCore(Matrix<T> data)
Parameters
dataMatrix<T>The independent components.
Returns
- Matrix<T>
Reconstructed data in original space.
TransformCore(Matrix<T>)
Transforms the data to independent components.
protected override Matrix<T> TransformCore(Matrix<T> data)
Parameters
dataMatrix<T>The data to transform.
Returns
- Matrix<T>
The independent components.