... | @@ -2,26 +2,43 @@ |
... | @@ -2,26 +2,43 @@ |
|
|
|
|
|
An implementation of non-negative matrix factorization. This can be used to decompose an input dataset into two low-rank non-negative components.
|
|
An implementation of non-negative matrix factorization. This can be used to decompose an input dataset into two low-rank non-negative components.
|
|
|
|
|
|
|
|
```prolog
|
|
|
|
:- use_module('path/to/.../src/methods/nmf/nmf.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],
|
|
|
|
nmf(multdist, 10000, 0.00001, TrainData, 3, 6, W, _, H, _).
|
|
|
|
```
|
|
|
|
|
|
# Available Predicates
|
|
# Available Predicates
|
|
|
|
|
|
* [nmf/13](/PrologMethods/Misc.-other/nmf#nmf13)
|
|
* [nmf/10](/PrologMethods/Misc.-other/nmf#nmf10)
|
|
|
|
|
|
---
|
|
---
|
|
|
|
|
|
[links/resources](/PrologMethods/Misc.-other/nmf#connected-linksresources)
|
|
[links/resources](/PrologMethods/Misc.-other/nmf#connected-linksresources)
|
|
|
|
|
|
## **_nmf/13_**
|
|
## **_nmf/10_**
|
|
|
|
|
|
Initilizes the nmf model and applies it to the given data.
|
|
Initilizes the nmf model and applies it to the given data.
|
|
|
|
|
|
```prolog
|
|
```prolog
|
|
%% part of the predicate definition
|
|
%% predicate definition
|
|
nmf( +string,
|
|
nmf(UpdateRule, MaxIterations, MinResidue, DataList, DataRows, Rank, WList, YCols, HList, ZCols) :-
|
|
+integer, +float32,
|
|
MaxIterations >= 0,
|
|
|
|
MinResidue >= 0,
|
|
|
|
Rank > 0,
|
|
|
|
convert_list_to_float_array(DataList, DataRows, array(Xsize, Xrows, X)),
|
|
|
|
nmfI(UpdateRule, MaxIterations, MinResidue, X, Xsize, Xrows, Rank, Y, YCols, YRows, Z, ZCols, ZRows),
|
|
|
|
convert_float_array_to_2d_list(Y, YCols, YRows, WList),
|
|
|
|
convert_float_array_to_2d_list(Z, ZCols, ZRows, HList).
|
|
|
|
|
|
|
|
%% foreign c++ predicate definition
|
|
|
|
foreign(nmf, c, nmfI( +string, +integer, +float32,
|
|
+pointer(float_array), +integer, +integer,
|
|
+pointer(float_array), +integer, +integer,
|
|
+integer,
|
|
+integer,
|
|
-pointer(float_array), -integer, -integer,
|
|
-pointer(float_array), -integer, -integer,
|
|
-pointer(float_array), -integer, -integer).
|
|
-pointer(float_array), -integer, -integer)).
|
|
```
|
|
```
|
|
|
|
|
|
### Parameters
|
|
### Parameters
|
... | @@ -41,8 +58,8 @@ nmf( +string, |
... | @@ -41,8 +58,8 @@ nmf( +string, |
|
|
|
|
|
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.
|
|
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::nmf_C++\_documentation**](https://www.mlpack.org/doc/stable/doxygen/classmlpack_1_1amf_1_1AMF.html)
|
|
* [**MLpack::nmf_C++\_documentation**](https://www.mlpack.org/doc/mlpack-3.4.2/doxygen/classmlpack_1_1amf_1_1AMF.html)
|
|
* [**MLpack::nmf_Python_documentation**](https://www.mlpack.org/doc/stable/python_documentation.html#nmf)
|
|
* [**MLpack::nmf_Python_documentation**](https://www.mlpack.org/doc/mlpack-3.4.2/python_documentation.html#nmf)
|
|
|
|
|
|
added some of the links from the python documentation
|
|
added some of the links from the python documentation
|
|
|
|
|
... | | ... | |