TfELM
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Kernel.Kernel Class Reference
Inheritance diagram for Kernel.Kernel:
Kernel.CombinedProductKernel Kernel.CombinedSumKernel

Public Member Functions

 __init__ (self, kernel_name='rbf', param=1.0)
 

Static Public Member Functions

 rbf (x, y, alpha=1.0)
 
 laplacian (x, y, alpha=1.0)
 
 sigmoid (x, y, alpha=1.0)
 
 exponential (x, y, alpha=1.0)
 
 cosine (x, y, alpha=None)
 
 morlet_wavelet (x, y, alpha=1.0)
 
 mexican_hat_wavelet (x, y, alpha=1.0)
 
 haar_wavelet (x, y, alpha=1.0)
 
 rational_quadratic (x, y, alpha=1.0)
 

Public Attributes

 kernel_name
 
 kernel_param
 
 ev
 

Constructor & Destructor Documentation

◆ __init__()

Kernel.Kernel.__init__ ( self,
kernel_name = 'rbf',
param = 1.0 )
    Initialize a kernel function object.

    Parameters:
    -----------
    - kernel_name (str): Name of the kernel function. Default is 'rbf'.
    - param (float): Parameter value for the kernel function. Default is 1.0.

Reimplemented in Kernel.CombinedSumKernel, and Kernel.CombinedProductKernel.

Member Function Documentation

◆ cosine()

Kernel.Kernel.cosine ( x,
y,
alpha = None )
static
    Cosine similarity kernel.

    Computes the cosine similarity between two vectors.

    .. math::
        K(x, y) = \\frac{{\\langle x, y \\rangle}}{{||x|| \\cdot ||y||}}

    Parameters:
    -----------
    - x (tf.Tensor): Input tensor.
    - y (tf.Tensor): Input tensor.
    - alpha (None): This parameter is not used. It's included for compatibility with other kernel functions.

    Returns:
    -----------
    tf.Tensor: Kernel values representing cosine similarity between x and y.

◆ exponential()

Kernel.Kernel.exponential ( x,
y,
alpha = 1.0 )
static
    Exponential kernel.

    .. math::
        K(x, y) = \\exp\\left(-\\alpha \\sqrt{||x - y||^2}\\right)

    Parameters:
    -----------
    - x (tf.Tensor): Input tensor.
    - y (tf.Tensor): Input tensor.
    - alpha (float): Parameter value for the exponential kernel. Default is 1.0.

    Returns:
    -----------
    tf.Tensor: Kernel values.

◆ haar_wavelet()

Kernel.Kernel.haar_wavelet ( x,
y,
alpha = 1.0 )
static
    Haar wavelet kernel.

    Parameters:
    -----------
    - x (tf.Tensor): Input tensor.
    - y (tf.Tensor): Input tensor.
    - alpha (float): Parameter value for the Haar wavelet kernel. Default is 1.0.

    Returns:
    -----------
    tf.Tensor: Kernel values.

◆ laplacian()

Kernel.Kernel.laplacian ( x,
y,
alpha = 1.0 )
static
    Laplacian kernel.

    .. math::
        K(x, y) = \\exp\\left(-\\frac{{||x - y||_1}}{{\\alpha}}\\right)

    Parameters:
    -----------
    - x (tf.Tensor): Input tensor.
    - y (tf.Tensor): Input tensor.
    - alpha (float): Parameter value for the Laplacian kernel. Default is 1.0.

    Returns:
    -----------
    tf.Tensor: Kernel values.

◆ mexican_hat_wavelet()

Kernel.Kernel.mexican_hat_wavelet ( x,
y,
alpha = 1.0 )
static
    Mexican hat wavelet kernel.

    .. math::
        K(x, y) = \\left(1 - \\left(\\frac{||x - y||^2}{\\alpha}\\right)^2\\right)
                    \\exp\\left(-\\frac{||x - y||^2}{2\\alpha^2}\\right)

    Parameters:
    -----------
    - x (tf.Tensor): Input tensor.
    - y (tf.Tensor): Input tensor.
    - alpha (float): Parameter value for the Mexican hat wavelet kernel. Default is 1.0.

    Returns:
    -----------
    tf.Tensor: Kernel values.

◆ morlet_wavelet()

Kernel.Kernel.morlet_wavelet ( x,
y,
alpha = 1.0 )
static
    Morlet wavelet kernel.

    .. math::
        K(x, y) = \\cos\\left(2\\pi\\frac{||x - y||^2}{\\alpha}\\right)

    Parameters:
    -----------
    - x (tf.Tensor): Input tensor.
    - y (tf.Tensor): Input tensor.
    - alpha (float): Parameter value for the Morlet wavelet kernel. Default is 1.0.

    Returns:
    -----------
    tf.Tensor: Kernel values.

◆ rational_quadratic()

Kernel.Kernel.rational_quadratic ( x,
y,
alpha = 1.0 )
static
    Rational quadratic kernel.

    .. math::
        K(x, y) = 1 - \\frac{||x - y||^2}{||x - y||^2 + \\alpha}

    Parameters:
    -----------
    - x (tf.Tensor): Input tensor.
    - y (tf.Tensor): Input tensor.
    - alpha (float): Parameter value for the rational quadratic kernel. Default is 1.0.

    Returns:
    -----------
    tf.Tensor: Kernel values.

◆ rbf()

Kernel.Kernel.rbf ( x,
y,
alpha = 1.0 )
static
    Radial Basis Function (RBF) kernel.

    .. math::
        K(x, y) = \\exp\\left(-\\frac{{||x - y||^2}}{{2 \\alpha^2}}\\right)

    Parameters:
    -----------
    - x (tf.Tensor): Input tensor.
    - y (tf.Tensor): Input tensor.
    - alpha (float): Parameter value for the RBF kernel. Default is 1.0.

    Returns:
    tf.Tensor: Kernel values.

◆ sigmoid()

Kernel.Kernel.sigmoid ( x,
y,
alpha = 1.0 )
static
    Sigmoid kernel.

    .. math::
        K(x, y) = \\tanh(\\alpha \\cdot \\langle x, y \\rangle)

    Parameters:
    -----------
    - x (tf.Tensor): Input tensor.
    - y (tf.Tensor): Input tensor.
    - alpha (float): Parameter value for the sigmoid kernel. Default is 1.0.

    Returns:
    -----------
    tf.Tensor: Kernel values.

The documentation for this class was generated from the following file: