matrix.interaction {adelie}R Documentation

Creates a matrix with pairwise interactions.

Description

Creates a matrix with pairwise interactions.

Usage

matrix.interaction(mat, intr_keys, intr_values, levels = NULL, n_threads = 1)

Arguments

mat

The dense matrix.

intr_keys

List of feature indices.

intr_values

List of list of feature indices.

levels

Levels.

n_threads

Number of threads.

Value

Pairwise interaction matrix.

Examples

n <- 10
p <- 20
X_dense <- matrix(rnorm(n * p), n, p)
X_dense[,1] <- rbinom(n, 4, 0.5)
intr_keys <- c(0, 1)
intr_values <- list(NULL, c(0, 2))
levels <- c(c(5), rep(0, p-1))
out <- matrix.interaction(X_dense, intr_keys, intr_values, levels)

[Package adelie version 1.0.1 Index]