nHot: Make n hot vector.

Description Usage Arguments Value Examples

View source: R/tiles.R

Description

Make n hot vector.

Usage

1
nHot(x, len, out = "matrix")

Arguments

x

[integer]
Which features are active?

len

[integer(1)]
Length of the feature vector.

out

[character(1)]
Format of the output. Can be a vector or a matrix.

Value

[matrix(1, len)] A one-row matrix with len columns with every entry 0 except the columns specified by x which are 1.

Examples

1
2
nHot(c(1, 3), 5)
nHot(c(1, 3), 5, out = "vector")

reinforcelearn documentation built on May 2, 2019, 9:20 a.m.