You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by ja...@apache.org on 2020/06/04 05:49:17 UTC
[systemml] branch master updated: [DOC] Documentation for builtin
toOneHot function
This is an automated email from the ASF dual-hosted git repository.
janardhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/systemml.git
The following commit(s) were added to refs/heads/master by this push:
new 859ad3a [DOC] Documentation for builtin toOneHot function
859ad3a is described below
commit 859ad3a72906c67b7300c9980251da4cde9ed8f8
Author: Parul Damalu <po...@gmail.com>
AuthorDate: Thu Jun 4 11:18:47 2020 +0530
[DOC] Documentation for builtin toOneHot function
Example description:
Number of classes (numClasses): 5
Input Matrix (X):
2.000 3.000 2.000
2.000 3.000 2.000
3.000 4.000 2.000
Result from toOneHot(X, numClasses):
0.000 1.000 0.000 0.000 0.000
0.000 1.000 0.000 0.000 0.000
0.000 0.000 1.000 0.000 0.000
Closes #939.
---
dev/docs/builtins-reference.md | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/dev/docs/builtins-reference.md b/dev/docs/builtins-reference.md
index 4346883..cf55a15 100644
--- a/dev/docs/builtins-reference.md
+++ b/dev/docs/builtins-reference.md
@@ -33,7 +33,7 @@ limitations under the License.
* [`steplm`-Function](#steplm-function)
* [`slicefinder`-Function](#slicefinder-function)
* [`normalize`-Function](#normalize-function)
-
+ * [`toOneHot`-Function](#toOneHOt-function)
# Introduction
@@ -442,3 +442,30 @@ y = X %*% rand(rows=ncol(X), cols=1)
y = normalize(X = X)
```
+
+## `toOneHot`-Function
+
+The `toOneHot`-function encodes unordered categorical vector to multiple binarized vectors.
+
+### Usage
+```r
+toOneHot(X, numClasses)
+```
+
+### Arguments
+| Name | Type | Default | Description |
+| :--------- | :------------- | -------- | :---------- |
+| X | Matrix[Double] | required | vector with N integer entries between 1 and numClasses. |
+| numClasses | int | required | number of columns, must be greater than or equal to largest value in X. |
+
+### Returns
+| Type | Description |
+| :------------- | :---------- |
+| Matrix[Double] | one-hot-encoded matrix with shape (N, numClasses). |
+
+### Example
+```r
+numClasses = 5
+X = round(rand(rows = 10, cols = 10, min = 1, max = numClasses))
+y = toOneHot(X,numClasses)
+```