arXiv:2608.29265stat.COAug 2026

Manuscript Offprint

arXiv:2608.29265

Signed random Fourier features for fast density estimation with indefinite kernels

Xie Wang, Nicolas Langrené, Wen Chen

Xie Wang ID1^{ID1}, Nicolas Langrené ID∗2^{ID*2}, and Wen Chen ID2^{ID2}

1^{1}Mathematical Institute, University of Oxford, Oxford, OX2 6GG, UK

2^{2}Guangdong Provincial/Zhuhai Key Laboratory of Interdisciplinary Research and Application for Data Science, Beijing Normal-Hong Kong Baptist University, Zhuhai 519087, China.

September 1, 2026

Kernel density estimation (KDE) is one of the most fundamental statistical estimators of density functions. Its direct implementation on a dataset of NN points incurs an O(N2)\mathcal{O}(N^2) computational cost, which is prohibitive for large-scale datasets. Kernel approximation techniques can be applied to bring the computational cost down to O(N)\mathcal{O}(N). The random Fourier features (RFF) technique, based on sampling from the spectral density of the kernel function, has become popular to speed up kernel estimators for machine learning applications. Unfortunately, it is restricted to positive definite kernels, while the majority of kernel functions popular in KDE, such as the parabolic kernel, do not satisfy this property. To overcome this limitation, this article introduces the signed random Fourier features (SRFF) technique. It is a generalization of RFF compatible with indefinite kernels whose inverse Fourier transform is absolutely integrable. The motivation for introducing this method is to speed up KDE in the case of multivariate compact kernels, which are generally not positive definite. We detail how to implement SRFF for both product kernels and isotropic kernels. For the class of Kuttner-Golubov kernels K(xi,xj)=(1−∥xi−xj∥α)β1{∥xi−xj∥≤1}K(\boldsymbol{x}_i, \boldsymbol{x}_j) = (1 - \|\boldsymbol{x}_i - \boldsymbol{x}_j\|^\alpha)^{\beta} \mathbb{1}_{\{\|\boldsymbol{x}_i - \boldsymbol{x}_j\| \leq 1\}} where xi∈Rd\boldsymbol{x}_i \in \mathbb{R}^d, xj∈Rd\boldsymbol{x}_j \in \mathbb{R}^d, α>0\alpha > 0, β>0\beta > 0, which includes the triangular, parabolic, bi-weight, triweight, and other kernel functions of interest for KDE as particular examples, we provide an explicit acceptance-rejection algorithm to sample from its signed spectral density. Our numerical tests on a dataset of one million points confirm the computational efficiency and accuracy of SRFF for large-scale KDE.

Keywords: signed Monte Carlo, spectral Monte Carlo, random Fourier features, random projections, kernel density estimation, acceptance-rejection method, Kuttner-Golubov kernel.

1. Introduction

Kernel-based estimators, such as kernel density estimators, are a cornerstone of statistical science. Their implementation, however, suffers from scalability issues: the computation of

*Corresponding author, nicolaslangrene@bnbu.edu.cn all the pairwise kernel values K(xi,xj)K(\boldsymbol{x}_i, \boldsymbol{x}_j) for a kernel function KK on a dataset x1,…,xN\boldsymbol{x}_1, \ldots, \boldsymbol{x}_N of NN points valued in Rd\mathbb{R}^d, 1≤i,j≤N1 \leq i, j \leq N, requires O(N2)\mathcal{O}(N^2) operations and O(N2)\mathcal{O}(N^2) memory space, which can quickly become prohibitive for large-scale datasets. Popular approximations of kernel functions in the field of machine learning, such as the Nyström method [32, 46] or random Fourier features [36] can be used to reduce these computational and memory costs. However, these approximation techniques require the kernel function KK to be positive definite (Subsection 3.1). In the context of kernel density estimation, this is a strong limitation. With a few exceptions, such as the Gaussian kernel, most kernel functions of interest in KDE, such as the parabolic kernel [12], are not positive definite, making these modern kernel decomposition techniques inapplicable.

When a kernel function KK is positive definite, the inverse Fourier transform of KK is proportional to a density ff, called spectral density (Bochner's theorem, Subsection 3.1). The RFF technique is constructed upon simulations from this spectral density. When KK is not positive definite, such as the parabolic kernel K(xi,xj)=(1−∥xi−xj∥2)1{∥xi−xj∥≤1}K(\boldsymbol{x}_i, \boldsymbol{x}_j) = (1 - \|\boldsymbol{x}_i - \boldsymbol{x}_j\|^2) \mathbb{1}_{\{\|\boldsymbol{x}_i - \boldsymbol{x}_j\| \leq 1\}}, the inverse Fourier transform ff still exists but is not a density anymore, as it takes negative values (Subsection A.2). From here, some articles such as [34] propose to approximate ff by a tractable nonnegative function, effectively overlooking the negative part of the spectral signed measure. Others, such as [26, 29, 19], propose to simulate f+/∥f+∥1f_+ / \|f_+\|_1 and f−/∥f−∥1f_- / \|f_-\|_1 separately, where f+=max⁡(f,0)f_+ = \max(f, 0), f−=max⁡(−f,0)f_- = \max(-f, 0), ∥f∥1=∫Rd∣f(x)∣dx\|f\|_1 = \int_{\mathbb{R}^d} |f(\boldsymbol{x})| d\boldsymbol{x}, provided ff is absolutely integrable (and therefore associated with a finite signed measure), and to apply the weights ∥f+∥1\|f_+\|_1 and ∥f−∥1\|f_-\|_1 to these simulated frequencies in the RFF estimator. One downside is that these weights are not analytical and their estimation may require costly computations.

In this article, we follow the latter approach, and improve it along several directions. Our key contribution is the introduction of the signed random Fourier features (SRFF) technique (Subsection 3.2), constructed upon simulations from the absolute spectral density ∣f∣/∥f∥1|f| / \|f\|_1, using a carefully designed acceptance-rejection algorithm (Subsection 4.3), and attaching to each simulated frequency the sign of the spectrum at that point. Compared to existing random features for indefinite kernels, its implementation does not require to compute the weights ∥f+∥1\|f_+\|_1, ∥f−∥1\|f_-\|_1, or ∥f∥1\|f\|_1, and it is shown to be more efficient than sampling from f+/∥f+∥1f_+ / \|f_+\|_1 and f−/∥f−∥1f_- / \|f_-\|_1 separately (Subsection 4.3). Then, we detail how to implement SRFF for fast kernel density estimation using the large class of multivariate compact kernels K(xi,xj)=(1−∥xi−xj∥α)β1{∥xi−xj∥≤1}K(\boldsymbol{x}_i, \boldsymbol{x}_j) = (1 - \|\boldsymbol{x}_i - \boldsymbol{x}_j\|^\alpha)^\beta \mathbb{1}_{\{\|\boldsymbol{x}_i - \boldsymbol{x}_j\| \leq 1\}}, α>0\alpha > 0, β>0\beta > 0, which contains many multivariate kernel functions of interest in KDE, such as the triangular, parabolic, biweight, triweight, and tricube kernels ([41, 27, 39, 5], Subsection 4.2), none of which are positive definite on multivariate datasets. While the existing theory of reproducing kernel Krein spaces (RKKS, [33, 21]) has shown that most kernel-based estimators still work in the case of indefinite kernels, our work is, to our knowledge, the first application of random features to the problem of multivariate kernel density estimation with indefinite kernels. Finally, our numerical tests on a dataset of N=1,000,000N = 1,000,000 points confirm the scalability offered by SRFF for large-scale KDE tasks.

The paper is organized as follows. Section 2 introduces a generalization of the Monte Carlo simulation method to integrals involving signed densities. Section 3 applies this extension to the inverse Fourier transform of kernel functions, yielding an extension of random Fourier features (RFF) to indefinite kernels, called signed random Fourier features (SRFF). Section 4 details how to use SRFF to speed the computation of kernel density estimators. Section 5 illustrates numerically the speed and accuracy of the proposed method, and Section 6 concludes the paper.

References (46)