matrix.one_hot {adelie}R Documentation

Creates a one-hot encoded matrix.

Description

Creates a one-hot encoded matrix.

Usage

matrix.one_hot(mat, levels = NULL, n_threads = 1)

Arguments

mat

The dense matrix.

levels

Levels.

n_threads

Number of threads.

Value

One-hot encoded matrix.

Examples

n <- 100
p <- 20
mat <- matrix(rnorm(n * p), n, p)
out <- matrix.one_hot(mat)

[Package adelie version 1.0.1 Index]