Skip to main content

kernel_diagonal

Function kernel_diagonal 

Source
pub fn kernel_diagonal<S>(
    x: &ArrayBase<S, Ix2>,
    kernel: &KernelType,
) -> Result<Array1<f64>>
where S: Data, S::Elem: Float + NumCast,
Expand description

Compute the diagonal of a kernel matrix (self-similarities)

§Arguments

  • x - Input data, shape (n_samples, n_features)
  • kernel - The kernel function type

§Returns

  • Result<Array1<f64>> - Diagonal entries k(x_i, x_i)