Linear: Linear kernel

View source: R/kernel_functions.R

LinearR Documentation

Linear kernel

Description

'Linear()' computes the inner product between all possible pairs of rows of a matrix or data.frame with dimension NxD.

Usage

Linear(X, cos.norm = FALSE, coeff = NULL)

Arguments

X

Matrix or data.frame that contains real numbers ("integer", "float" or "double").

cos.norm

Should the resulting kernel matrix be cosine normalized? (Defaults: FALSE).

coeff

(optional) A vector of length D that weights each one of the features (columns). When cos.norm=TRUE, 'Linear()' first does the weighting and then the cosine-normalization.

Value

Kernel matrix (dimension: NxN).

Examples

dat <- matrix(rnorm(250),ncol=50,nrow=5)
Linear(dat)

kerntools documentation built on April 3, 2025, 7:52 p.m.