Developer Guide and Reference

  • 2021.1
  • 12/04/2020
  • Public Content
Contents

Kernel Functions

Kernel functions form a class of algorithms for pattern analysis. The main characteristic of kernel functions is a distinct approach to this problem. Instead of reducing the dimension of the original data, kernel functions map the data into higher-dimensional spaces in order to make the data more easily separable there.

Linear Kernel

A linear kernel is the simplest kernel function.
Problem Statement
Given a set
X
of
n
feature vectors LaTex Math image. of dimension
p
and a set
Y
of
m
feature vectors LaTex Math image. , the problem is to compute the linear kernel function LaTex Math image. for any pair of input vectors: LaTex Math image. .
Batch Processing
Algorithm Input
The linear kernel function accepts the input described below. Pass the
Input ID
as a parameter to the methods that provide input for your algorithm.
Input ID
Input
X
Pointer to the LaTex Math image. numeric table that represents the matrix X. This table can be an object of any class derived from NumericTable.
Y
Pointer to the LaTex Math image. numeric table that represents the matrix Y. This table can be an object of any class derived from NumericTable.
Algorithm Parameters
The linear kernel function has the following parameters:
Parameter
Default Value
Description
algorithmFPType
float
The floating-point type that the algorithm uses for intermediate computations. Can be
float
or
double
.
method
defaultDense
Available computation methods:
  • defaultDense
    - default performance-oriented method
  • fastCSR
    - performance-oriented method for CSR numeric tables
computationMode
matrixMatrix
Computation mode for the kernel function. Can be:
For CPU:
  • vectorVector
    - compute the kernel function for given feature vectors LaTex Math image. and LaTex Math image.
  • matrixVector
    - compute the kernel function for all vectors in the set
    X
    and a given feature vector LaTex Math image.
  • matrixMatrix
    - compute the kernel function for all vectors in the sets
    X
    and
    Y
    . In oneDAL, this mode requires equal numbers of observations in both input tables: LaTex Math image. .
For GPU:
  • matrixMatrix
    - compute the kernel function for all vectors in the sets
    X
    and
    Y
    . In oneDAL, this mode requires equal numbers of observations in both input tables: LaTex Math image. .
rowIndexX
0
Index i of the vector in the set
X
for the
vectorVector
computation mode.
rowIndexY
0
Index
j
of the vector in the set
Y
for the
vectorVector
or
matrixVector
computation mode.
rowIndexResult
0
Row index in the values numeric table to locate the result of the computation for the
vectorVector
computation mode.
k
1.0
The coefficient
k
of the linear kernel.
b
0.0
The coefficient
b
of the linear kernel.
Algorithm Output
The linear kernel function calculates the results described below. Pass the
Result ID
as a parameter to the methods that access the results of your algorithm.
Result ID
Result
values
Pointer to the LaTex Math image. numeric table with the values of the kernel function.
By default, this result is an object of the
HomogenNumericTable
class, but you can define the result as an object of any class derived from
NumericTable
except
PackedSymmetricMatrix
,
PackedTriangularMatrix
, and
CSRNumericTable
.
Examples
oneAPI DPC++
oneAPI C++
Java*
There is no support for Java on GPU.
Batch Processing:

Radial Basis Function Kernel

The Radial Basis Function (RBF) kernel is a popular kernel function used in kernelized learning algorithms.
Problem Statement
Given a set
X
of
n
feature vectors LaTex Math image. of dimension
p
and a set
Y
of
m
feature vectors LaTex Math image. , the problem is to compute the RBF kernel function LaTex Math image. for any pair of input vectors:
LaTex Math image.
Batch Processing
Algorithm Input
The RBF kernel accepts the input described below. Pass the Input ID as a parameter to the methods that provide input for your algorithm.
Input ID
Input
X
Pointer to the LaTex Math image. numeric table that represents the matrix
X
. This table can be an object of any class derived from
NumericTable
.
Y
Pointer to the LaTex Math image. numeric table that represents the matrix
Y
. This table can be an object of any class derived from
NumericTable
.
Algorithm Parameters
The RBF kernel has the following parameters:
Parameter
Default Value
Description
algorithmFPType
float
The floating-point type that the algorithm uses for intermediate computations. Can be
float
or
double
.
method
defaultDense
Available computation methods:
  • defaultDense
    - default performance-oriented method
  • fastCSR
    - performance-oriented method for CSR numeric tables
computationMode
matrixMatrix
Computation mode for the kernel function. Can be:
For CPU:
  • vectorVector
    - compute the kernel function for given feature vectors LaTex Math image. and LaTex Math image.
  • matrixVector
    - compute the kernel function for all vectors in the set
    X
    and a given feature vector LaTex Math image.
  • matrixMatrix
    - compute the kernel function for all vectors in the sets
    X
    and
    Y
    . In oneDAL, this mode requires equal numbers of observations in both input tables: LaTex Math image. .
For GPU:
  • matrixMatrix
    - compute the kernel function for all vectors in the sets
    X
    and
    Y
    . In oneDAL, this mode requires equal numbers of observations in both input tables: LaTex Math image. .
rowIndexX
0
Index
i
of the vector in the set
X
for the
vectorVector
computation mode.
rowIndexY
0
Index
j
of the vector in the set
Y
for the
vectorVector
or
matrixVector
computation mode.
rowIndexResult
0
Row index in the values numeric table to locate the result of the computation for the
vectorVector
computation mode.
sigma
1.0
The coefficient LaTex Math image. of the RBF kernel.
Algorithm Output
The RBF kernel calculates the results described below. Pass the Result ID as a parameter to the methods that access the results of your algorithm.
Result ID
Result
values
Pointer to the LaTex Math image. numeric table with the values of the kernel function.
By default, this result is an object of the
HomogenNumericTable
class, but you can define the result as an object of any class derived from
NumericTable
except
PackedSymmetricMatrix
,
PackedTriangularMatrix
, and
CSRNumericTable
.
Examples
oneAPI DPC++
oneAPI C++
Java*
There is no support for Java on GPU.
Batch Processing:

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.