... | ... | @@ -2,26 +2,44 @@ |
|
|
|
|
|
An implementation of RADICAL, a method for independent component analysis (ICA). Given a dataset, this can decompose the dataset into an unmixing matrix and an independent component matrix. This can be useful for preprocessing.
|
|
|
|
|
|
```prolog
|
|
|
:- use_module('path/to/.../src/methods/radical/radical.pl').
|
|
|
|
|
|
%% usage example
|
|
|
TrainData = [5.1,3.5,1.4, 4.9,3.0,1.4, 4.7,3.2,1.3, 4.6,3.1,1.5],
|
|
|
radical_initModel(0.175,30,150,0,0),
|
|
|
doRadical(TrainData, 3, Y, _, W, _).
|
|
|
```
|
|
|
|
|
|
# Available Predicates
|
|
|
|
|
|
* [initModel/5](/PrologMethods/Transformation/radical#initmodel5)
|
|
|
* [doRadical/9](/PrologMethods/Transformation/radical#doradical9)
|
|
|
* [doRadical2D/4](/PrologMethods/Transformation/radical#doradical2d4)
|
|
|
* [radical_initModel/5](/PrologMethods/Transformation/radical#radical_initmodel5)
|
|
|
* [doRadical/6](/PrologMethods/Transformation/radical#doradical6)
|
|
|
* [doRadical2D/3](/PrologMethods/Transformation/radical#doradical2d3)
|
|
|
|
|
|
---
|
|
|
|
|
|
[links/resources](/PrologMethods/Transformation/radical#connected-linksresources)
|
|
|
|
|
|
## **_initModel/5_**
|
|
|
## **_radical_initModel/5_**
|
|
|
|
|
|
Initilizes the radical model.
|
|
|
|
|
|
```prolog
|
|
|
%% part of the predicate definition
|
|
|
initModel(+float32, +integer, +integer, +integer, +integer).
|
|
|
%% predicate definition
|
|
|
radical_initModel(NoiseStdDev, Replicates, Angles, Sweeps, M) :-
|
|
|
NoiseStdDev >= 0,
|
|
|
Replicates > 0,
|
|
|
Angles > 0,
|
|
|
Sweeps >= 0,
|
|
|
initModelI(NoiseStdDev, Replicates, Angles, Sweeps, M).
|
|
|
|
|
|
%% foreign c++ predicate definition
|
|
|
foreign(initModel, c, initModelI(+float32, +integer, +integer, +integer, +integer)).
|
|
|
```
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
| Name | Type | Description | Default |
|
|
|
|------|------|-------------|---------|
|
|
|
| noiseStdDev | +float | Standard deviation of the Gaussian noise added to the replicates of the data points during Radical2D. | 0.175 |
|
... | ... | @@ -32,18 +50,26 @@ initModel(+float32, +integer, +integer, +integer, +integer). |
|
|
|
|
|
---
|
|
|
|
|
|
## **_doRadical/9_**
|
|
|
## **_doRadical/6_**
|
|
|
|
|
|
Run RADICAL.
|
|
|
|
|
|
```prolog
|
|
|
%% part of the predicate definition
|
|
|
doRadical( +pointer(float_array), +integer, +integer,
|
|
|
%% predicate definition
|
|
|
doRadical(DataList, DataRows, YList, YCols, WList, ZCols) :-
|
|
|
convert_list_to_float_array(DataList, DataRows, array(Xsize, Xrows, X)),
|
|
|
doRadicalI(X, Xsize, Xrows, Y, YCols, YRows, Z, ZCols, ZRows),
|
|
|
convert_float_array_to_2d_list(Y, YCols, YRows, YList),
|
|
|
convert_float_array_to_2d_list(Z, ZCols, ZRows, WList).
|
|
|
|
|
|
%% foreign c++ predicate definition
|
|
|
foreign(doRadical, c, doRadicalI( +pointer(float_array), +integer, +integer,
|
|
|
-pointer(float_array), -integer, -integer,
|
|
|
-pointer(float_array), -integer, -integer).
|
|
|
-pointer(float_array), -integer, -integer)).
|
|
|
```
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
| Name | Type | Description | Default |
|
|
|
|------|------|-------------|---------|
|
|
|
| X | +matrix | Input data into the algorithm - a matrix where each column is a point and each row is a dimension. | - |
|
... | ... | @@ -52,17 +78,23 @@ doRadical( +pointer(float_array), +integer, +integer, |
|
|
|
|
|
---
|
|
|
|
|
|
## **_doRadical2D/4_**
|
|
|
## **_doRadical2D/3_**
|
|
|
|
|
|
Two-dimensional version of RADICAL.
|
|
|
|
|
|
```prolog
|
|
|
%% part of the predicate definition
|
|
|
doRadical2D( +pointer(float_array), +integer, +integer,
|
|
|
[-float32]).
|
|
|
%% predicate definition
|
|
|
doRadical2D(DataList, DataRows, Result) :-
|
|
|
convert_list_to_float_array(DataList, DataRows, array(Xsize, Xrows, X)),
|
|
|
doRadical2DI(X, Xsize, Xrows, Result).
|
|
|
|
|
|
%% foreign c++ predicate definition
|
|
|
foreign(doRadical2D, c, doRadical2DI( +pointer(float_array), +integer, +integer,
|
|
|
[-float32])).
|
|
|
```
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
| Name | Type | Description | Default |
|
|
|
|------|------|-------------|---------|
|
|
|
| X | +matrix | Input data into the algorithm - a matrix where each column is a point and each row is a dimension. | - |
|
... | ... | @@ -74,8 +106,8 @@ doRadical2D( +pointer(float_array), +integer, +integer, |
|
|
|
|
|
If you want a more detailed explanation, then go to the python documentation. There is most of the time a good explanation on how the methods work and what the parameters do.
|
|
|
|
|
|
* [**MLpack::radical_C++\_documentation**](https://www.mlpack.org/doc/stable/doxygen/classmlpack_1_1radical_1_1Radical.html)
|
|
|
* [**MLpack::radical_Python_documentation**](https://www.mlpack.org/doc/stable/python_documentation.html#radical)
|
|
|
* [**MLpack::radical_C++\_documentation**](https://www.mlpack.org/doc/mlpack-3.4.2/doxygen/classmlpack_1_1radical_1_1Radical.html)
|
|
|
* [**MLpack::radical_Python_documentation**](https://www.mlpack.org/doc/mlpack-3.4.2/python_documentation.html#radical)
|
|
|
|
|
|
added some of the links from the python documentation
|
|
|
|
... | ... | |