Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ICA meta examples and cookbook page for fastICA
-Also turn UWdge convergence error into warning -Excluded UWedgeSep for now
- Loading branch information
Showing
10 changed files
with
179 additions
and
6 deletions.
There are no files selected for viewing
Submodule data
updated
8 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
============================== | ||
Independent Component Analysis | ||
============================== | ||
|
||
Independent component analysis (ICA) separates a multivariate signal into additive subcomponents that are maximally independent. | ||
It is typically used for separating superimposed signals. | ||
|
||
The ICA algorithm presented here is fastICA, see :cite:`hyvarinen2000independent` for details. | ||
There are many other ICA implementations, all based on :sgclass:`CICAConverter` | ||
|
||
------- | ||
Example | ||
------- | ||
|
||
Given a dataset which we assume consists of linearly mixed signals, we create CDenseFeatures | ||
(RealFeatures, here 64 bit float values). | ||
|
||
.. sgexample:: ica_fast.sg:create_features | ||
|
||
We create the :sgclass:`CFastICA` instance, and set its parameter for the iterative optimization. | ||
|
||
.. sgexample:: ica_fast.sg:set_parameters | ||
|
||
Then we apply ICA, which gives the unmixed signals. | ||
|
||
.. sgexample:: ica_fast.sg:apply_convert | ||
|
||
We can also extract the estimated mixing matrix. | ||
|
||
.. sgexample:: ica_fast.sg:extract | ||
|
||
---------- | ||
References | ||
---------- | ||
:wiki:`Independent_component_analysis` | ||
|
||
.. bibliography:: ../../references.bib | ||
:filter: docname in docnames |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
CSVFile f_feats("../../data/ica_2_sources.dat") | ||
|
||
Math:init_random(1) | ||
|
||
#![create_features] | ||
RealFeatures features(f_feats) | ||
#![create_features] | ||
|
||
#![set_parameters] | ||
FastICA ica() | ||
ica.set_max_iter(200) | ||
ica.set_tol(0.00001) | ||
#![set_parameters] | ||
|
||
#![apply_convert] | ||
Features converted = ica.apply(features) | ||
#![apply_convert] | ||
|
||
#![extract] | ||
RealMatrix mixing_matrix = ica.get_mixing_matrix() | ||
RealFeatures casted = RealFeatures:obtain_from_generic(converted) | ||
RealMatrix unmixed_signal = casted.get_feature_matrix() | ||
#![extract] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
CSVFile f_feats("../../data/ica_2_sources.dat") | ||
|
||
Math:init_random(1) | ||
|
||
#![create_features] | ||
RealFeatures features(f_feats) | ||
#![create_features] | ||
|
||
#![set_parameters] | ||
FFSep ica() | ||
ica.set_max_iter(200) | ||
ica.set_tol(0.00001) | ||
#![set_parameters] | ||
|
||
#![apply_convert] | ||
Features converted = ica.apply(features) | ||
#![apply_convert] | ||
|
||
#![extract] | ||
RealMatrix mixing_matrix = ica.get_mixing_matrix() | ||
RealFeatures casted = RealFeatures:obtain_from_generic(converted) | ||
RealMatrix unmixed_signal = casted.get_feature_matrix() | ||
#![extract] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
CSVFile f_feats("../../data/ica_2_sources.dat") | ||
|
||
Math:init_random(1) | ||
|
||
#![create_features] | ||
RealFeatures features(f_feats) | ||
#![create_features] | ||
|
||
#![set_parameters] | ||
Jade ica() | ||
ica.set_max_iter(200) | ||
ica.set_tol(0.00001) | ||
#![set_parameters] | ||
|
||
#![apply_convert] | ||
Features converted = ica.apply(features) | ||
#![apply_convert] | ||
|
||
#![extract] | ||
RealMatrix mixing_matrix = ica.get_mixing_matrix() | ||
RealFeatures casted = RealFeatures:obtain_from_generic(converted) | ||
RealMatrix unmixed_signal = casted.get_feature_matrix() | ||
#![extract] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
CSVFile f_feats("../../data/ica_2_sources.dat") | ||
|
||
Math:init_random(1) | ||
|
||
#![create_features] | ||
RealFeatures features(f_feats) | ||
#![create_features] | ||
|
||
#![set_parameters] | ||
JediSep ica() | ||
ica.set_max_iter(200) | ||
ica.set_tol(0.00001) | ||
#![set_parameters] | ||
|
||
#![apply_convert] | ||
Features converted = ica.apply(features) | ||
#![apply_convert] | ||
|
||
#![extract] | ||
RealMatrix mixing_matrix = ica.get_mixing_matrix() | ||
RealFeatures casted = RealFeatures:obtain_from_generic(converted) | ||
RealMatrix unmixed_signal = casted.get_feature_matrix() | ||
#![extract] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
CSVFile f_feats("../../data/ica_2_sources.dat") | ||
|
||
Math:init_random(1) | ||
|
||
#![create_features] | ||
RealFeatures features(f_feats) | ||
#![create_features] | ||
|
||
#![set_parameters] | ||
SOBI ica() | ||
ica.set_max_iter(200) | ||
ica.set_tol(0.00001) | ||
#![set_parameters] | ||
|
||
#![apply_convert] | ||
Features converted = ica.apply(features) | ||
#![apply_convert] | ||
|
||
#![extract] | ||
RealMatrix mixing_matrix = ica.get_mixing_matrix() | ||
RealFeatures casted = RealFeatures:obtain_from_generic(converted) | ||
RealMatrix unmixed_signal = casted.get_feature_matrix() | ||
#![extract] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters