Learn R Programming

kerntools (version 1.2.0)

Linear: 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)

Value

Kernel matrix (dimension: NxN).

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.

Examples

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

Run the code above in your browser using DataLab