Skip to main content

Module kernel_utils

Module kernel_utils 

Source
Expand description

Kernel utility functions for machine learning workflows.

This module provides practical utilities for kernel-based machine learning:

  • Kernel-target alignment for measuring kernel quality
  • Gram matrix operations (eigendecomposition preparation)
  • Distance matrix computation from kernels
  • Kernel matrix validation

Functionsยง

compute_gram_matrix
Compute the kernel matrix from data using a given kernel function.
distances_from_kernel
Compute pairwise distances from a kernel matrix.
estimate_kernel_rank
Compute the effective dimensionality (rank) of a kernel matrix based on normalized eigenvalue spectrum.
is_valid_kernel_matrix
Check if a kernel matrix is valid (symmetric and positive semi-definite).
kernel_target_alignment
Compute kernel-target alignment (KTA) between a kernel matrix and target labels.
median_heuristic_bandwidth
Compute kernel bandwidth using median heuristic.
normalize_rows
Normalize each row of a data matrix (L2 normalization).