coroICA-python¶
Version 0.1.24
-
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, skip_sklearn_checks=False)[source]¶ Bases:
sklearn.base.BaseEstimator
,sklearn.base.TransformerMixin
coroICA transformer
- Parameters
- n_componentsint, optional
Number of components to extract. If none is passed, the same number of components as the input has dimensions is used.
- n_components_uwedgeint, 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_componentsboolean, 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_matricesfloat 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.
- groupsizeint, 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).
- partitionsizeint 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.
- partitionsizeint, 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.
- timelagslist of strictly positive ints, optional
List of time lags to be considered for computing lagged covariance matrices.
- instantcovboolean, optional
If False, no non-lagged instant (lag = 0) covariance matrices are used.
- max_iterint, optional
Maximum number of iterations for the uwedge approximate joint diagonalisation during fitting.
- tolfloat, optional
Tolerance for terminating the uwedge approximate joint diagonalisation during fitting.
- minimize_lossboolean, 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_thresholdint, 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_stateint, 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.
- skip_sklearn_checks: boolean, optional (default=False)
If True, the sklearn checks check_array and check_X_y are being skipped. This enables complex value support; sklearn does not support complex values and check_array and check_X_y would throw a ValueError. As also the other sanity checks performed in check_array and check_X_y are being skipped, special caution is required when enabling this option.
- 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
(self, X[, y, group_index, partition_index])Fit the model
fit_transform
(self, X[, y])Fit to data, then transform it.
get_params
(self[, deep])Get parameters for this estimator.
set_params
(self, \*\*params)Set the parameters of this estimator.
transform
(self, X)Returns the data projected onto the fitted components
-
fit
(self, X, y=None, group_index=None, partition_index=None)[source]¶ Fit the model
- Parameters
- Xarray, shape (n_samples, n_features)
where n_samples is the number of samples and n_features is the number of features.
- yIgnored.
- group_indexarray, 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_indexarray, 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
- selfobject
Returns self.
-
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, skip_sklearn_checks=False)[source]¶ Bases:
sklearn.base.BaseEstimator
,sklearn.base.TransformerMixin
uwedgeICA transformer
- Parameters
- n_componentsint, optional
Number of components to extract. If none is passed, the same number of components as the input has dimensions is used.
- n_components_uwedgeint, 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_componentsboolean, optional
When true, the components will be ordered in decreasing stability.
- partitionsizeint 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.
- timelagslist of strictly positive ints, optional
List of time lags to be considered for computing lagged covariance matrices.
- instantcovboolean, optional
If False, no non-lagged instant (lag = 0) covariance matrices are used.
- max_iterint, optional
Maximum number of iterations for the uwedge approximate joint diagonalisation during fitting.
- tolfloat, optional
Tolerance for terminating the uwedge approximate joint diagonalisation during fitting.
- minimize_lossboolean, 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_thresholdint, 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.
- skip_sklearn_checks: boolean, optional (default=False)
If True, the sklearn checks check_array and check_X_y are being skipped. This enables complex value support; sklearn does not support complex values and check_array and check_X_y would throw a ValueError. As also the other sanity checks performed in check_array and check_X_y are being skipped, special caution is required when enabling this option.
- 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
(self, X[, y, partition_index])Fit the model
fit_transform
(self, X[, y])Fit to data, then transform it.
get_params
(self[, deep])Get parameters for this estimator.
set_params
(self, \*\*params)Set the parameters of this estimator.
transform
(self, X)Returns the data projected onto the fitted components
-
fit
(self, X, y=None, partition_index=None)[source]¶ Fit the model
- Parameters
- Xarray, shape (n_samples, n_features)
where n_samples is the number of samples and n_features is the number of features.
- yIgnored.
- partition_indexarray, 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
- selfobject
Returns self.