fenwick-mmd 0.3.0

Formally verified, sub-quadratic minimax-optimal kernel two-sample testing (MMD) via compressed multidimensional Fenwick trees and orthantwise separable kernels
Documentation
from typing import Sequence

class PermutationTestResult:
    mmd_squared: float
    threshold: float
    p_value: float
    reject: bool
    num_permutations: int
    alpha: float
    aos_error_bound: float

class AggregatedTestResult:
    reject: bool
    min_adjusted_p_value: float
    best_kernel_index: int
    per_kernel: list[PermutationTestResult]

def py_mmd_squared(
    x: Sequence[Sequence[float]],
    y: Sequence[Sequence[float]],
    bandwidths: Sequence[float],
    kernel: str = "laplace",
    gaussian_tol: float = 1e-4,
) -> float: ...

def py_mmd_squared_exact(
    x: Sequence[Sequence[float]],
    y: Sequence[Sequence[float]],
    bandwidths: Sequence[float],
    kernel: str = "laplace",
    gaussian_tol: float = 1e-4,
) -> float: ...

def py_permutation_test(
    x: Sequence[Sequence[float]],
    y: Sequence[Sequence[float]],
    bandwidths: Sequence[float] | None = None,
    kernel: str = "laplace",
    num_permutations: int = 199,
    alpha: float = 0.05,
    seed: int = 42,
    gaussian_tol: float = 1e-4,
) -> PermutationTestResult: ...

def py_aggregated_mmd_test(
    x: Sequence[Sequence[float]],
    y: Sequence[Sequence[float]],
    bandwidth_grid: Sequence[Sequence[float]],
    kernel: str = "laplace",
    num_permutations: int = 199,
    alpha: float = 0.05,
    seed: int = 42,
    gaussian_tol: float = 1e-4,
) -> AggregatedTestResult: ...

def py_pca_mmd_test(
    x: Sequence[Sequence[float]],
    y: Sequence[Sequence[float]],
    proj_dim: int,
    kernel: str = "laplace",
    bandwidths: Sequence[float] | None = None,
    num_permutations: int = 199,
    alpha: float = 0.05,
    seed: int = 42,
    sample_split: bool = True,
    gaussian_tol: float = 1e-4,
) -> PermutationTestResult: ...

def py_median_bandwidths(
    x: Sequence[Sequence[float]],
    y: Sequence[Sequence[float]],
    max_points: int = 512,
) -> list[float]: ...