coroICA-python

Version 0.1.20

class coroica.CoroICA(n_components=None, n_components_uwedge=None, rank_components=False, pairing='complement', max_matrices=1, groupsize=None, partitionsize=None, timelags=None, instantcov=True, max_iter=5000, tol=1e-12, minimize_loss=False, condition_threshold=None, random_state=None)[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin

coroICA transformer

Parameters:
n_components : int, optional

Number of components to extract. If none is passed, the same number of components as the input has dimensions is used.

n_components_uwedge : int, optional

Number of components to extract during uwedge approximate joint diagonalization of the matrices. If none is passed, the same number of components as the input has dimensions is used.

rank_components : boolean, optional

When true, the components will be ordered in decreasing stability.

pairing : {‘complement’, ‘allpairs’, ‘neighbouring’}

Whether difference matrices should be computed for all pairs of partition covariance matrices or only in a one-vs-complement scheme or only of neighbouring partition covariance matrices.

max_matrices : float or ‘no_partitions’, optional (default=1)

The fraction of (lagged) covariance matrices to use during training or, if ‘no_partitions’, at most as many covariance matrices are used as there are partitions.

groupsize : int, optional

Approximately how many samples, when doing a rigid grid, shall be in each group. If none is passed, all samples will be in one group unless group_index is passed during fitting in which case the provided group index is used (the latter is the advised and preferred way).

partitionsize : int or list of int, optional

Approximately how many samples, when doing a rigid grid, should be in each partition. If none is passed, a (hopefully sane) default is used unless partition_index is passed during fitting in which case the provided partition index is used.

partitionsize : int, optional

Approximately how many samples, when doing a rigid grid, should be in each partition. If none is passed, a (hopefully sane) default is used, again, unless partition_index is passed during fitting in which case the provided partition index is used.

timelags : list of ints, optional

List of time lags to be considered for computing lagged covariance matrices.

instantcov : boolean, optional

If False, no non-lagged instant (lag = 0) covariance matrices are used.

max_iter : int, optional

Maximum number of iterations for the uwedge approximate joint diagonalisation during fitting.

tol : float, optional

Tolerance for terminating the uwedge approximate joint diagonalisation during fitting.

minimize_loss : boolean, optional

If True at each iteration the loss of the uwedge approximate joint diagonalisation is computed (computationally expensive) and after convergence the V with minimal loss along the optimisation path is returned instead of the terminal V.

condition_threshold : int, optional (default=None)

If int, the uwedge iteration is stopped when the condition number of the unmixing matrix grows beyond condition_threshold. If None, no such condition number check is performed.

random_state : int, RandomState instance or None, optional (default=None)

If int, random_state is seeded used by the random number generator; if RandomState instance, random_state is the random number generator; if None, the random number generator is the RandomState instance used by np.random.

Attributes:
V_ : array, shape (n, n_features)

The unmixing matrix; where n=n_features if n_components and n_components_uwedge are None, n=n_components_uwedge if n_components is None, and n=n_components otherwise.

converged_ : boolean

Whether the approximate joint diagonalisation converged due to tol.

n_iter_ : int

Number of iterations of the approximate joint diagonalisation.

meanoffdiag_ : float

Mean absolute value of the off-diagonal values of the to be jointly diagonalised matrices, i.e., a proxy of the approximate joint diagonalisation objective function.

Methods

fit(X[, y, group_index, partition_index]) Fit the model
fit_transform(X[, y]) Fit to data, then transform it.
get_params([deep]) Get parameters for this estimator.
set_params(**params) Set the parameters of this estimator.
transform(X) Returns the data projected onto the fitted components
fit(X, y=None, group_index=None, partition_index=None)[source]

Fit the model

Parameters:
X : array, shape (n_samples, n_features)

where n_samples is the number of samples and n_features is the number of features.

y : Ignored.
group_index : array, optional, shape (n_samples,)

Codes for each sample which group it belongs to; if no group index is provided a rigid grid with self.groupsize samples per group is used (which defaults to all samples if self.groupsize was not set).

partition_index : array, optional, shape (n_samples,)

Codes for each sample which partition it belongs to; if no partition index is provided a rigid grid with self.partitionsize samples per partition within each group is used (which has a (hopefully sane) default if self.partitionsize was not set).

Returns:
self : object

Returns self.

transform(X)[source]

Returns the data projected onto the fitted components

Parameters:
X : array, shape (n_samples, n_features)

where n_samples is the number of samples and n_features is the number of features.

Returns:
X_transformed : array, shape (n_samples, n_components)
class coroica.UwedgeICA(n_components=None, n_components_uwedge=None, rank_components=False, partitionsize=None, timelags=None, instantcov=True, max_iter=1000, tol=1e-12, minimize_loss=False, condition_threshold=None)[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin

uwedgeICA transformer

Parameters:
n_components : int, optional

Number of components to extract. If none is passed, the same number of components as the input has dimensions is used.

n_components_uwedge : int, optional

Number of components to extract during uwedge approximate joint diagonalization of the matrices. If none is passed, the same number of components as the input has dimensions is used.

rank_components : boolean, optional

When true, the components will be ordered in decreasing stability.

partitionsize : int or list of int, optional

Approximately how many samples, when doing a rigid grid, should be in each partition. If none is passed, a (hopefully sane) default is used unless partition_index is passed during fitting in which case the provided partition index is used.

timelags : list of ints, optional

List of time lags to be considered for computing lagged covariance matrices.

instantcov : boolean, optional

If False, no non-lagged instant (lag = 0) covariance matrices are used.

max_iter : int, optional

Maximum number of iterations for the uwedge approximate joint diagonalisation during fitting.

tol : float, optional

Tolerance for terminating the uwedge approximate joint diagonalisation during fitting.

minimize_loss : boolean, optional

If True at each iteration the loss of the uwedge approximate joint diagonalisation is computed (computationally expensive) and after convergence the V with minimal loss along the optimisation path is returned instead of the terminal V.

condition_threshold : int, optional (default=None)

If int, the uwedge iteration is stopped when the condition number of the unmixing matrix grows beyond condition_threshold. If None, no such condition number check is performed.

Attributes:
V_ : array, shape (n, n_features)

The unmixing matrix; where n=n_features if n_components and n_components_uwedge are None, n=n_components_uwedge if n_components is None, and n=n_components otherwise.

converged_ : boolean

Whether the approximate joint diagonalisation converged due to tol.

n_iter_ : int

Number of iterations of the approximate joint diagonalisation.

meanoffdiag_ : float

Mean absolute value of the off-diagonal values of the to be jointly diagonalised matrices, i.e., a proxy of the approximate joint diagonalisation objective function.

Methods

fit(X[, y, partition_index]) Fit the model
fit_transform(X[, y]) Fit to data, then transform it.
get_params([deep]) Get parameters for this estimator.
set_params(**params) Set the parameters of this estimator.
transform(X) Returns the data projected onto the fitted components
fit(X, y=None, partition_index=None)[source]

Fit the model

Parameters:
X : array, shape (n_samples, n_features)

where n_samples is the number of samples and n_features is the number of features.

y : Ignored.
partition_index : array, optional, shape (n_samples,)

Codes for each sample which partition it belongs to; if no partition index is provided a rigid grid with self.partitionsize_ samples per partition within each group is used (which has a (hopefully sane) default if self.partitionsize_ was not set).

Returns:
self : object

Returns self.

transform(X)[source]

Returns the data projected onto the fitted components

Parameters:
X : array, shape (n_samples, n_features)

where n_samples is the number of samples and n_features is the number of features.

Returns:
X_transformed : array, shape (n_samples, n_components)