kitchen_sink: Project data with Convolutional Kitchen Sinks

View source: R/kitchen_sink.R

kitchen_sinkR Documentation

Project data with Convolutional Kitchen Sinks

Description

This function projects data with Convolutional Kitchen Sinks. It matrix multiplies data with a normal matrix that must be provided, clamping the negative results to 0, and then averaging across windows. Feature count and window size are determined by the column and row numbers of the provided normal matrix respectively.

Usage

kitchen_sink(
  data,
  norm,
  FUN = clamp,
  ncores = 1,
  write_progress = FALSE,
  which_rows = NULL,
  ...
)

Arguments

data

The data to be projected. Should not include the variable to be modeled by the kitchen sink.

norm

A normal matrix of dimensions c(window size, feature count). Can be generated using make_norms(). Window size should be no larger than the size (column length) of the data.

FUN

A function to be used for nonlinearization of the normalized data. The default, clamp, sets negative values to 0. Other alternatives include cos() and sin().

ncores

How many cores to use for the kitchen sink. Allows for parallelization in large datasets.

write_progress

Write files for each row calculated. May be helpful for breaking up large calculations.

which_rows

Specify rows to calculate for. Along with write_progress, may be helpful for breaking up large calculations.

...

Arguments to be passed to FUN, like a bias term.

Value

Returns a matrix of nonlinearized counterparts to the original rows of the provided data. Column length is equal to the number of features, as determined by the provided normal matrix. #'

Author(s)

Avery Kruger

See Also

make_norms()

clamp

Examples

x <- matrix(sample(1:10,500,TRUE),100,5)
y <- x[,1]*x[,2]^2-0.5*x[,3]*x[,4]+x[,5]*x[,1]

mynorm <- make_norms(64,5)[[1]][[1]]
nonlinx <- kitchen_sink(x, mynorm, bias=0.1)
summary(lm(y ~ nonlinx))


avery-kruger/kitchen documentation built on May 7, 2024, 6:40 a.m.