Manuscript Offprint
arXiv:2608.29265Signed random Fourier features for fast density estimation with indefinite kernels
Xie Wang , Nicolas Langrené , and Wen Chen
Mathematical Institute, University of Oxford, Oxford, OX2 6GG, UK
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 points incurs an computational cost, which is prohibitive for large-scale datasets. Kernel approximation techniques can be applied to bring the computational cost down to . 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 where , , , , 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 for a kernel function on a dataset of points valued in , , requires operations and 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 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 is positive definite, the inverse Fourier transform of is proportional to a density , called spectral density (Bochner's theorem, Subsection 3.1). The RFF technique is constructed upon simulations from this spectral density. When is not positive definite, such as the parabolic kernel , the inverse Fourier transform 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 by a tractable nonnegative function, effectively overlooking the negative part of the spectral signed measure. Others, such as [26, 29, 19], propose to simulate and separately, where , , , provided is absolutely integrable (and therefore associated with a finite signed measure), and to apply the weights and 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 , 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 , , or , and it is shown to be more efficient than sampling from and separately (Subsection 4.3). Then, we detail how to implement SRFF for fast kernel density estimation using the large class of multivariate compact kernels , , , 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 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.
2.1. Signed Monte Carlo formula
Let be a real-valued, -dimensional continuous random vector with probability density function , and let be a measurable function such that is absolutely integrable. By elementary probability theory, we have the following
This probabilistic representation (1) suggests the following unbiased Monte Carlo estimator of the integral :
where are i.i.d. simulations from the distribution of . This is known as the Monte Carlo integration method. We now extend this construction to the case where the function is no longer a probability density function. In particular, is not nonnegative everywhere. From here onwards, we relax the assumption that is a probability density and only assume that is absolutely integrable over , with no non-negativity imposed.
Lemma 1. Let be an absolutely integrable function, not identically equal to zero. Then
where is such that , is a probability density function, and where the sign function is defined as
Proof. Simply use the fact that for all , and then multiply and divide by on the right hand side, which, from the assumptions, exists, is positive and finite.
Lemma 2. Let be an absolutely integrable function such that , and let be a measurable function such that is absolutely integrable. Then, the following holds
where is a continuous random vector with probability density function , and where the sign function is defined in Lemma 1.
Proof. First, remark that the assumption implies that is not uniformly equal to zero, and therefore . This ensures that is a well-defined probability density function. Then, using Lemma 1,
where the random vector X has density . Next, applying equation (5) with gives
Finally, dividing equation (5) by equation (6), using the fact that , yields equation (4).
Remark 1. The classical formula (1), where is probability density function, is a special case of (4). Indeed, if happens to be a probability density function, then , has density , and almost surely.
Remark 2. The proof of Lemma 2 shows that equation (5) provides an alternative representation for as an expectation. Moreover, unlike equation (4), equation (5) does not require . The reason why we favour equation (4) over equation (5) is that in most applications, such as the random Fourier features application from Section 3, is known explicitly, while has generally no closed-form analytical expression.
Notation 1. In the rest of the paper, a function as defined in Lemma 2 will be called a signed density, and we say that a random variable has signed density if for any measurable function such that is absolutely integrable, the expectation is given by equation (4). This is a natural way to define the density of a signed measure (see also [31, 35]).
2.2. Signed Monte Carlo estimator
Lemma 2 suggests the following signed Monte Carlo estimator for the integral :
where are i.i.d. vector simulations from the distribution of . Indeed, using the strong law of large numbers and Lemma 2, the Monte Carlo estimator (7) converges almost surely as :
We refer to equation (7) as the Signed Monte Carlo (SMC) integration method, because each Monte Carlo simulation is multiplied by either +1 or -1, depending on the sign of .
Remark 3. In practice, a simple way to make the random event a.s. impossible in equation (7) is to set the number of Monte Carlo samples as an odd number.
3. Signed random Fourier features
In this section, we extend the spectral Monte Carlo idea underpinning the random Fourier features [36] technique to the signed Monte Carlo approach developed in the previous section. This extension enables us to construct random Fourier features for kernel functions which are not positive definite. Subsection 3.1 recalls the details of the standard random Fourier features (RFF) construction, and Subsection 3.2 introduces the aforementioned extension, called signed random Fourier features (SRFF). Finally, Subsection 3.3 simplifies the SRFF construction in the case of multivariate product and isotropic kernels, which are of practical importance for kernel density estimation.
3.1. Random Fourier features (RFF)
Let be a continuous, stationary kernel function. is called positive definite if for any , and real coefficients ,
According to Bochner’s theorem [3, 4], a continuous, stationary kernel is positive definite if and only if there exists a finite measure such that
In other words, K is proportional to a characteristic function. Suppose that is absolutely continuous with respect to the Lebesgue measure [37, Theorem 1.8.16]. Then, there exists a (multivariate) density f such that
where . In other words, is the multivariate Fourier transform of . According to Bochner's theorem, is nonnegative if and only if is positive definite. This means that is a probability density function, known as the spectral density of , if and only if is positive definite. To further simplify equation (9), we additionally assume that is symmetric.
Assumption 1. We assume that the kernel function is symmetric: for all .
Under Assumption 1, the function f is symmetric as well and the imaginary part in equation (9) disappears, meaning that equation (9) can be further explicited into the following probabilistic representation:
where is a continuous random vector with density , where is the Fourier dual of :
The random vector is known as random projection. To sum up, under the symmetry assumption 1, the probabilistic representation (10) holds if and only if K is positive definite. In such a case, the multivariate kernel K can be approximated by Monte Carlo simulations:
where are M i.i.d. vector simulations from the distribution of . This Monte Carlo approach (12) is known as random Fourier features [36], and is a popular way to speed up the computation of kernel-based estimators in machine learning applications. We refer the reader to [25] for further examples and details on the implementation of random Fourier features.
3.2. Signed random Fourier features (SRFF)
One key limitation of the approach (10)-(12) is that it does not hold if the kernel function is not positive definite. In this subsection, we explicitly generalize equation (12) to the case where the kernel K is not positive definite, using the signed Monte Carlo theory developed in Section 2.
Theorem 1. [Signed random Fourier features] Let be a continuous, symmetric kernel function such that , and such that the inverse Fourier transform of (equation (11)) is absolutely integrable. Then, the following holds:
where the random projection vector has probability density function .
Proof. Using equation (10) with and the condition , we obtain the following
which makes Lemma 2 applicable. Then, using equation (10) and Lemma 2 with for fixed yields
where the random vector has density , which is well defined since is assumed to be absolutely integrable.
Theorem 1 provides a probabilistic representation of continuous, symmetric kernel functions K which does not require K to be positive definite. Indeed, Theorem 1 does not require the inverse Fourier transform of K to be nonnegative, it only requires it to be absolutely integrable [2]. As such, it can be viewed as a generalization of the random Fourier features approach [36]. We call this extension signed random Fourier features.
Theorem 1 suggests the following Monte Carlo estimator of for any :
where are i.i.d. simulations from the random vector with density . This corresponds to the complex feature mapping
for all , , where, for any ,
In practice, a convenient way to simulate the random projection is the acceptance-rejection method [44], as it avoids the computation of the scaling constant which appears in the density of and is usually not analytical and hard to estimate (see Subsection 4.3).
3.3. Special multivariate kernels
The signed random Fourier feature mapping (16) can be readily applied to decompose multivariate indefinite kernels. That being said, its implementation can be further simplified in the cases of the most popular multivariate kernel constructions in density estimation, namely product kernels and isotropic kernels [17].
3.3.1. Product kernels
Product kernels, also known as multiplicative kernels, are defined as
where , and , are univariate kernel functions, usually, but not necessarily, chosen equal. For every dimension , let be the inverse Fourier transform of .
When the product kernel (17) is positive definite, all the univariate kernels , are positive definite as well, with spectral density . Then, using [37, Theorem 1.3.10], equation (17) holds if and only if is the characteristic function of the random vector where the are independent random variables with density . In particular, the inverse Fourier transform of satisfies , for all .
Consider now the indefinite setting. When the product kernel (17) is not positive definite, some of the functions are not densities anymore, and may take negative values. Suppose that each is nevertheless absolutely integrable. Then, the equation still holds, and the product kernel (17) admits the signed random Fourier features representation (13) with the random projection vector defined such that the random variables are independent with density respectively.
3.3.2. Isotropic kernels
Isotropic kernels, also known as radially symmetric kernels, are defined as
where , and is a univariate kernel function.
When the isotropic kernel (18) is positive definite, its spectral density f exists and is also isotropic. Consequently, the spectral distribution f admits an explicit representation as a scale mixture of the random distribution on the d-dimensional unit sphere, as proved in the following proposition.
Proposition 2. The -dimensional random vector has a radial isotropic) density , where with , if and only if there exists a random vector uniformly distributed on the -dimensional unit sphere, and a nonnegative random variable , independent of , whose density is explicitly given by
such that .
Proof. The equivalence between the isotropy of the distribution of and its scale mixture representation is a consequence of Schoenberg's theorem [37, Corollary 3.8.3]. Next, since is a density, . Using a polar change of variable [14, Corollary 2.51 and Proposition 2.54 page 79],
This ensures that the nonnegative function is integrable, and integrates to one. In other words, is a probability density function. Then, for any , using the same polar change of variable,
On the other hand, and
Since cumulative distribution functions fully characterize probability distributions, this proves that for all . In other words, equation (19) holds and defines a probability density function.
Remark 4. Let denote the set of kernels that are positive definite in , and let denote the set of kernels that are positive definite in for all . Recall that [37, page 173]. The spectral scale mixture described in Proposition 2 is valid for every kernel in . It is therefore more general than the Gaussian spectral scale mixture described in [25], which only applies to kernels in . Examples of kernels in include the triangular kernel , whose spectral density is the Fejér-de la Vallée-Poussin density [8][20, page 207][9, page 100], and the Silverman kernel [40, 43], whose spectral density is the Laha density [23, 6], a.k.a. Butterworth filter [18]. However, unlike the construction described in [25], equation (19) requires an analytical expression for the spectral density of the kernel under consideration.
When the isotropic kernel (18) is not positive definite, equation (19) does not define a density anymore, and may take negative values. Suppose that is nevertheless absolutely integrable. Then, the isotropic kernel (18) admits the signed random Fourier features representation (13) with the random projection vector , where is a random vector uniformly distributed on the -dimensional unit sphere, and is a random variable, independent of , with density , where is defined by equation (19).
4. Fast kernel density estimation
This section describes how to use the signed random Fourier features methodology (Section 3) to improve the computational efficiency of kernel density estimation.
4.1. Fast KDE computation
Let be a dataset and be a stationary, symmetric kernel function. Define the column vector and the kernel matrix . We are interested in computing the following kernel matrix vector multiplication (MVM):
Equation (20) contains the kernel density estimator , where , as a particular case, and the Nadaraya-Watson kernel regression estimator can be written as . Both estimators are evaluated at each data point .
A direct computation of the kernel MVM (20) requires operations. However, by using the signed random Fourier features approximation (14) of the kernel function with random projections , one obtains for any ,
This formula can be computed for every in operations, as described in Algorithm 1.
Algorithm 1: Fast kernel MVM by signed random Fourier features
Inputs: Dataset , Stationary, symmetric kernel , , the inverse Fourier transform of , Random projections , drawn independently from the density .
for do for do end end
for do end
Outputs: ,
Observe that Algorithm 1 does not directly use the complex-valued feature mapping (16), and therefore does not require to work with complex numbers.
Remark 5. As discussed in [24], kernel density estimators with adaptive bandwidths, such as (balloon bandwidth [42], where the bandwidths depend on the evaluation point ), do not benefit from the decomposition provided by the cosine formula , as the resulting cross terms and cannot disentangle the sources from the targets , making fast summation approaches such as Algorithm 1 inapplicable. Instead, one can mimic the -NN balloon bandwidth estimator with equal number of data points in each bandwidth support [28, 42, 24], known to be robust in multivariate settings [42], by applying a uniformization feature mapping to the input dataset , where is the rank of in , and then applying the fast algorithm 1 with constant bandwidth to this transformed dataset.
4.2. Choice of multivariate kernel function
The implementation of the fast KDE algorithm described in the above Subsection 4.1 depends on the choice of kernel function K, as spectral sampling requires to know the Fourier transform of K.
Only a few kernel functions commonly used in KDE, such as the multivariate Gaussian kernel , are positive definite in for all . For such kernels,
KDE computations can be performed efficiently using the classical random Fourier features approach (12). We refer to [25] for additional examples of such kernels, along with their corresponding spectral sampling schemes.
However, the vast majority of kernel functions commonly used in KDE are either only positive definite for low-dimensional datasets, or are simply not positive definite. Many of them are particular cases of the following multivariate isotropic compact kernel, which may be called the Kuttner-Golubov kernel, or central generalized beta kernel, defined by
where and . Finding the conditions on and such that is positive definite in is the so-called Kuttner-Golubov problem [22, 16, 15], and remains an open problem in the general case. The class of compact kernels (21) encompasses, up to a multiplicative constant (see Lemma 3), many kernels of interest in density estimation and kernel smoothing [41, 27, 39, 5], including the triangular kernel (, , a.k.a. hat function [38]), the parabolic kernel (, , a.k.a. Epanechnikov kernel [12]), the biweight kernel (, , a.k.a. quartic, or bisquare kernel [27]), the triweight kernel (, ), and the tricube kernel (, ). These are summarized in Table 1.
| Kernel name | Formula | ||
|---|---|---|---|
| Triangular | |||
| Parabolic | |||
| Biweight | |||
| Triweight | |||
| Tricube |
Table 1: Examples of kernel functions included in the Kuttner-Golubov class (21)
Remark 6. Here, the kernel function (21) is defined such that for simplicity, however smoothing tasks may require that . This latter scaling can be achieved by dividing equation (21) by the constant term computed in Lemma 3 in Appendix.
Proposition 3 in Appendix provides an explicit formula for the Fourier transform of the general Kuttner-Golubov kernel (21) in terms of the Fox-Wright generalized hypergeometric function, as well as more explicit Fourier transform formulas in the special cases (Askey kernels, Corollary 2) and (symmetric beta kernels, Corollary 1) in terms of confluent hypergeometric functions. This provides explicit formulas for the function from equation (19). One can verify that is absolutely integrable if and only if , in which case the spectral radius density is well defined, and can be simulated efficiently by acceptance-rejection, as shown in the next subsection. If , then the isotropic kernel approach (subsection 3.3.2) is not compatible with the signed random Fourier features methodology (13) (because ). In this case, one should either change kernel and pick one such that , or use the product kernel approach (subsection 3.3.1), which is compatible with SRFF without any dimensional restriction.
4.3. Spectral rejection sampling
In this subsection, we describe how to simulate isotropic spectral densities, as described in Subsection 3.3.2, in practice. This step is required to implement the signed random Fourier features estimator (14), as well as the fast kernel density estimator described in Algorithm 1. In the case of isotropic kernels, the random projection has the distribution of a scale mixture . The random vector is uniformly distributed on the -dimensional unit sphere, and can easily be simulated as , where is a standard -dimensional Gaussian vector. The random variable is independent of , and has density , where is defined by equation (19). Simulating is the only difficulty in the simulation of the random projection .
From equation (19), the density of the spectral radius is proportional to the function , , where , is the inverse Fourier transform of the kernel under consideration. Remark that the function is going to depend on , see for example equations (28), (31), and (34). In order to simulate from such density, the most practical option is to use acceptance-rejection sampling [44]. To do so, it is sufficient to find an integrable, nonnegative envelope such that
and such that it is easy to simulate from the density . Then, the acceptance-rejection algorithm works as follows.
Algorithm 2: Simulating random spectral radius by acceptance-rejection
Input: Function satisfying the inequality (22)
1 Let be a simulation from the density .
2 Let be a simulation from a standard uniform distribution, independent of
3 if then
4 | Return
5 else
6 | Go back to line 1
7 end
Output: is a simulation from the spectral radius .
In the case of the isotropic compact kernels from Table 1, using a uniform proposal distribution as in [26] or a Gaussian proposal distribution as in [19] would not work, because the tails of these proposal densities decay much more quickly than the one of the Fourier transform (28), which decays as an inverse power function. Instead, we propose the following envelope function :
for some positive constants, , , , . First, is set to match the decay of the function for large . Then, the three constants , , and are set as follows:
The constant can be computed from equation (11) (it is the maximum value of the inverse Fourier transform ), while the constants and can be estimated numerically for fixed . The density is a mixture of a beta, uniform, and Pareto densities with non-overlapping support, and can easily be simulated using the composition approach, as explained in Algorithm 3 below.
Algorithm 3: Simulating proposal distribution from equation (23)
Inputs: Constants , , , and from equation (23)
1 Define and
2 Let and be two independent standard uniform simulations
3 if then
4 Return Beta distribution on
5 else if then
6 Return Uniform distribution on
7 else
8 Return Pareto distribution on
9 end
Output: One simulation from the spectral proposal density .
Figures 1-2-3 illustrate the proposed envelope function (23) with optimized parameters in the case of the triangular, parabolic, and triweight kernels respectively, from up to (in the case of the triweight kernel).
Remark 7. In the univariate case , which also covers the case of product kernels (17), the beta component of the proposal distribution (23) disappears, and only the uniform and Pareto components remain. The resulting simplified curve is a scaled version of the one proposed in [20, page 207] to simulate the Fejér-de la Vallée-Poussin distribution (Figure 1, left) by acceptance-rejection.

Figure 1: Proposal densities for the spectral radius densities proportional to of the triangular kernel (left: , right: ).

Figure 2: Proposal densities for the spectral radius densities proportional to of the parabolic kernel (left: , right: ).

Figure 3: Proposal densities for the spectral radius densities proportional to of the triweight kernel (top left: , top right: , bottom left: , bottom right: ).
For comparison, Figure 4 applies the same optimized envelope (23) to the positive and negative parts and of the inverse Fourier transform of the univariate parabolic kernel. This figure illustrates why sampling from and separately by acceptance-rejection, as done in [26, 29, 19] is less efficient than sampling from (Figure 2): since and have non-overlapping support, the effective rejection rate is much higher in the sampling approach (Figure 4, rejection is guaranteed more than half of the time) than in the sampling approach (Figure 2).

Figure 4: Proposal densities for the truncated spectral radius densities proportional to the positive part (left) and the negative part (right) of the inverse Fourier transform of the univariate parabolic kernel. To be compared to Figure 2 (left).
Finally, Figures 5-6-7-8-9-10 show on some examples that the signed random Fourier features formula (14) implemented with the spectral rejection sampling algorithms 2-3 is indeed able to recover the shape of univariate and bivariate indefinite kernels.

Figure 5: Univariate triangular kernel and its random Fourier features approximation (12) using M = 1000 random projections.


Figure 6: Bivariate triangular kernel (left) and its signed random Fourier features approximation (14) (right) using M = 4000 random projections.

Figure 7: Univariate parabolic kernel and its signed random Fourier features approximation (14) using M = 1000 random projections.


Figure 8: Bivariate parabolic kernel (left) and its signed random Fourier features approximation (14) (right) using M = 4000 random projections.

Figure 9: Univariate triweight kernel and its signed random Fourier features approximation (14) using M = 1000 random projections.


Figure 10: Bivariate triweight kernel (left) and its signed random Fourier features approximation (14) (right) using M = 4000 random projections.
5. Numerical experiments
In this section, we conduct numerical tests to evaluate the performance and accuracy of the fast kernel density estimation Algorithm 1. The goal is to compare the results obtained using SRFF with those produced by direct summation, and to evaluate both the computational efficiency and the precision of this approximation method.
Computational setup
The accuracy experiments are performed on a laptop equipped with a 13th Gen Intel(R) Core(TM) i9-13900H processor running at 2.60 GHz and 32.0 GB of RAM (31.7 GB usable). The runtime experiments are performed on a Linux compute node with 64 CPU cores (128 threads), a base clock speed of 2.9 GHz, a maximum clock speed of 4.0 GHz, 2048 GB of RAM, and 9.7 TB of scratch disk space. The experiments use 16 CPU threads. Algorithm 1 is implemented in C++. Runtime is measured using high-resolution clock functions.
Error metric
To measure the approximation error of the SRFF algorithm, we compute the mean absolute error (MAE) between the kernel MVM (20) and its SRFF approximation computed by Algorithm 1, averaged over the whole dataset :
which depends on the simulations of the random projection vector . Since this MAE is random, in practice we resimulate these random projections times independently, and report the sample average
where , , are independent copies of the set of independent simulations .
Accuracy evaluation
We evaluate the accuracy of SRFF using the MAE defined above. We fix and consider and as examples. For each dimension, we test 28 values of , ranging from 17 to 196,609. For each pair of and , we report the mean MAE over distinct random trials. Within each trial, we generate one master sequence containing 196,609 random frequencies. For a given , the estimator uses the first frequencies from this sequence. The estimates are therefore nested across different values of within the same trial, while different trials use independent master sequences.

Figure 11: Mean absolute error of SRFF with respect to M (left: d = 1, right: d = 2).
Figure 11 shows, as expected, an overall decrease in MAE as M increases. With L = 5, small local fluctuations are still visible, but the log-log trends have slopes close to , as expected from the Monte Carlo approximation formula (14). When M = 196,609, the average MAE is approximately for d = 1 and for d = 2.
Speed evaluation
To assess computational efficiency, we compare the runtime of direct KDE, with complexity , with that using SRFF decomposition, with complexity . In this numerical experiment using the parabolic kernel, we set and consider and . The reported runtimes are averaged over seven repeated experiments.

Figure 12: Runtime comparison between direct KDE and SRFF KDE with respect to the number of random features M (left: d = 1, right: d = 2).
Figure 12 shows that the SRFF runtime increases approximately linearly with M in both dimensions, as expected. For any reasonable value of M (usually set to a few hundreds or a few thousands in the literature), SRFF provides huge computational savings compared to direct KDE. For example, when M = 1000, KDE is computed on N = 1,000,000 points in about 2 seconds using SRFF, which is more than a hundred times faster than direct KDE evaluation. By combining the results from Figures 11 and 12, one can adjust the value of M to achieve any desired trade-off between approximation accuracy and computational cost.
6. Conclusion
This article introduced the signed random Fourier features technique (14) (SRFF), which is an extension of the classical random Fourier features technique [36] (RFF) to kernel function that are not positive definite, such as most compact kernel functions encountered in kernel density estimation (Table 1). We provided a detailed algorithm to simulate the signed spectral distribution of such kernels (Algorithm 3) in the case of the general class of compact multivariate Kuttner-Golubov kernels (21), for which we provided an analytical formula (28) for its Fourier transform. We showed that sampling from the absolute value of the inverse Fourier transform of the indefinite kernel under consideration by acceptance-rejection is more efficient than sampling from its positive part and negative part independently, as done so far in the literature. Moreover, our approach does not require to compute the constants , , or analytically. Then, we constructed an algorithm to perform fast kernel matrix-vector multiplication using SRFF (Algorithm 1), which includes kernel density estimation as a particular case. Our numerical tests confirm the speed and accuracy of SRFF for kernel density estimation. More generally, the SRFF methodology can be applied to any kernel-based estimator built upon indefinite kernels, and the underpinning signed Monte Carlo methodology (7) can be applied to any sampling estimator built upon signed densities.
Acknowledgements
Wen Chen acknowledges the support of the BNBU Start-up Research Fund UICR0700082-24. Nicolas Langrené and Wen Chen acknowledge the support of the Guangdong Provincial/Zhuhai Key Laboratory of IRADS (2022B1212010006).
References
[1] Askey, R. (1973). Radial characteristic functions. Technical report, University of Wisconsin-Madison. Technical summary report n°1262. (Cited on page 24)
[2] Berry, A. C. (1931). Necessary and sufficient conditions in the theory of Fourier transforms. Annals of Mathematics, 32(4):830–838. (Cited on page 6)
[3] Bochner, S. (1933). Monotone Funktionen, Stieltjessche Integrale und harmonische Analyse. Mathematische Annalen, 108(1):378–410. (Cited on page 5)
[4] Bochner, S. (1959). Lectures on Fourier integrals, volume 42. Princeton University Press. (Cited on page 5)
[5] Chacón, J. E. and Duong, T. (2018). Multivariate Kernel Smoothing and its Applications, volume 160 of Monographs on Statistics and Applied Probability. Chapman and Hall. (Cited on pages 2 and 11)
[6] Crooks, G. E. (2019). Field Guide to Continuous Probability Distributions. Berkeley Institute for Theoretical Science. (Cited on page 9)
[7] Davies, B. (2002). Integral Transforms and Their Applications, volume 41 of Texts in Applied Mathematics. Springer, 3rd edition. (Cited on page 22)
[8] Davis, K. B. (1975). Mean square error properties of density estimates. Annals of Statistics, 3(4):1025–1030. (Cited on page 9)
[9] Devroye, L. (2006). Nonuniform random variate generation. In Handbooks in Operations Research and Management Science, volume 13, chapter 4, pages 83–121. Elsevier. (Cited on page 9)
[10] DLMF (2026). NIST Digital Library of Mathematical Functions. F. W. J. Olver, A. B. Olde Daalhuis, D. W. Lozier, B. I. Schneider, R. F. Boisvert, C. W. Clark, B. R. Miller, B. V. Saunders, H. S. Cohl, and M. A. McClain, eds. (Cited on pages 23 and 25)
[11] Duong, T. (2015). Spherically symmetric multivariate beta family. Statistics and Probability Letters, 104:141–145. (Cited on pages 22 and 24)
[12] Epanechnikov, V. A. (1969). Non-parametric estimation of a multivariate probability density. Theory of Probability and Its Applications, 14(1):153–158. (Cited on pages 2 and 11)
[13] Fasshauer, G. (2007). Meshfree approximation methods with Matlab, volume 6 of Interdisciplinary Mathematical Sciences. World Scientific Publishing. (Cited on page 22)
[14] Folland, G. (1999). Real Analysis: Modern Techniques and Their Applications. Wiley, 2nd edition. (Cited on pages 8 and 22)
[15] Gneiting, T. (2001). Criteria of Pólya type for radial positive definite functions. Proceedings of the American Mathematical Society, 129(8):2309–2318. (Cited on page 11)
[16] Golubov, B. I. (1981). On Abel-Poisson type and Riesz means. Analysis Mathematica, 7(3):161–184. (Cited on page 11)
[17] Härdle, W., Müller, M., Sperlich, S., and Werwatz, A. (2004). Nonparametric and semiparametric models. Springer Series in Statistics. Springer. (Cited on page 7)
[18] Härdle, W. K. and Nussbaum, M. (1994). Kernel estimation: the equivalent spline smoothing method. Technical Report IRTG 1792 Discussion Paper 2020-010, Humboldt-Universität zu Berlin. (Cited on page 9)
[19] He, M., He, F., Liu, F., and Huang, X. (2024). Random Fourier features for asymmetric kernels. Machine Learning, 113(11):8459–8485. (Cited on pages 2, 12, and 14)
[20] Hörmann, W., Leydold, J., and Derflinger, G. (2004). Automatic Nonuniform Random Variate Generation. Springer. (Cited on pages 9 and 13)
[21] Huang, X., Maier, A., Hornegger, J., and Suykens, J. A. K. (2017). Indefinite kernels in least squares support vector machines and principal component analysis. Applied and Computational Harmonic Analysis, 43(1):162–172. (Cited on page 2)
[22] Kuttner, B. (1944). On the Riesz means of a Fourier series (II). Journal of the London Mathematical Society, 19(74):77–84. (Cited on page 11)
[23] Laha, R. (1958). An example of a nonnormal distribution where the quotient follows the Cauchy law. Proceedings of the National Academy of Sciences, 44(2):222–223. (Cited on page 9)
[24] Langrené, N. and Warin, X. (2019). Fast and stable multivariate kernel density estimation by fast sum updating. Journal of Computational and Graphical Statistics, 28(3):596–608. (Cited on page 10)
[25] Langrené, N., Warin, X., and Gruet, P. (2025). A spectral mixture representation of isotropic kernels with application to random Fourier features. arXiv:2411.02770. (Cited on pages 6, 8, 9, and 11)
[26] Liu, F., Huang, X., Chen, Y., and Suykens, J. (2021). Fast learning in reproducing kernel Krein spaces via signed measures. In International Conference on Artificial Intelligence and Statistics, pages 388–396. PMLR. (Cited on pages 2, 12, and 14)
[27] Loader, C. (1999). Local Regression and Likelihood. Statistics and Computing. Springer. (Cited on pages 2 and 11)
[28] Loftsgaarden, D. and Quesenberry, C. (1965). A nonparametric estimate of a multivariate density function. Annals of Mathematical Statistics, 36(3):1049–1051. (Cited on page 10)
[29] Luo, Q., Fang, K., Yang, J., and Huang, X. (2021). Towards unbiased random features with lower variance for stationary indefinite kernels. In 2021 International Joint Conference on Neural Networks (IJCNN), pages 1–8. IEEE. (Cited on pages 2 and 14)
[30] Marron, J. and Nolan, D. (1988). Canonical kernels for density estimation. Statistics and Probability Letters, 7(3):195–199. (Cited on page 24)
[31] Monchietti, E., Massri, C., de Barros, A., and Holik, F. (2025). Measure-theoretic approach to negative probabilities. Journal of Physics A: Mathematical and Theoretical, 58(34):345302. (Cited on page 4)
[32] Nyström, E. J. (1930). Über die praktische Auflösung von Integralgleichungen mit Anwendungen auf Randwertaufgaben. Acta Mathematica, 54:185–204. (Cited on page 2)
[33] Ong, C. S., Mary, X., Canu, S., and Smola, A. J. (2004). Learning with non-positive kernels. In Proceedings of the 21st International Conference on Machine Learning, pages 639–646. (Cited on page 2)
[34] Pennington, J., Yu, F. X., and Kumar, S. (2015). Spherical random features for polynomial kernels. In Advances in Neural Information Processing Systems, volume 28, pages 1846–1854. (Cited on page 2)
[35] Polson, N. and Sokolov, V. (2025). Negative probability. Applied Stochastic Models in Business and Industry, 41(1):e2910. (Cited on page 4)
[36] Rahimi, A. and Recht, B. (2007). Random features for large-scale kernel machines. In Advances in Neural Information Processing Systems, volume 20, pages 1177–1184. (Cited on pages 2, 5, 6, and 19)
[37] Sasvári, Z. (2013). Multivariate Characteristic and Correlation Functions, volume 50 of De Gruyter Studies in Mathematics. De Gruyter. (Cited on pages 5, 7, and 8)
[38] Schaback, R. (1995). Creating surfaces from scattered data using radial basis functions. In Mathematical Methods for Curves and Surfaces, pages 477–496. (Cited on page 11)
[39] Scott, D. (2015). Multivariate Density Estimation: Theory, Practice and Visualization. Wiley Series in Probability and Statistics. Wiley, 2nd edition. (Cited on pages 2 and 11)
[40] Silverman, B. (1984). Spline smoothing: the equivalent variable kernel method. Annals of Statistics, 12(3):898–916. (Cited on page 9)
[41] Silverman, B. (1986). Density Estimation for Statistics and Data Analysis, volume 26 of Monographs on Statistics and Applied Probability. Chapman and Hall. (Cited on pages 2 and 11)
[42] Terrell, G. and Scott, D. (1992). Variable kernel density estimation. Annals of Statistics, 20(3):1236–1265. (Cited on page 10)
[43] Tsybakov, A. (2009). Introduction to Nonparametric Estimation. Springer Series in Statistics. Springer. (Cited on page 9)
[44] von Neumann, J. (1951). Various techniques used in connection with random digits. Journal of Research of the National Bureau of Standards, 12:36–38. (Cited on pages 7 and 12)
[45] Watson, G. (1944). A Treatise on the Theory of Bessel Functions. Cambridge University Press, 2nd edition. (Cited on page 23)
[46] Williams, C. and Seeger, M. (2000). Using the Nyström method to speed up kernel machines. In Advances in Neural Information Processing Systems, volume 13. (Cited on page 2)
[47] Zastavnyi, V. (2006). On some properties of Buhmann functions. Ukrainian Mathematical Journal, 58(8). (Cited on page 22)
A. Fourier transforms of multivariate compact kernels
Let , , be a continuous, isotropic (a.k.a. radial) kernel in . Then its Fourier transform is also radial, and given by [13, Theorem B.1]:
where is the Bessel function of the first kind with order . Bochner's theorem tells us that equation (24) is a density, known as spectral density, if and only if the kernel K is positive definite. In this Appendix, we are going to compute equation (24) for several kernels of interest in density estimation.
A.1. Kuttner-Golubov kernels
Recall the definition of the Kuttner-Golubov kernel (21):
where and . First, Lemma 3 computes the integral of this kernel, which is needed whenever a kernel estimator requires the kernel function to be scaled as a density.
Lemma 3. The integral of the Kuttner-Golubov kernel function K defined in equation (21) is given explicitly by
Proof. Using a polar change of variable [14, Corollary 2.51 and Proposition 2.54 page 79],
(26)
Then,
Plugging equation (27) into equation (26) proves equation (25).
The normalizing constant (25) generalizes the one obtained in [11] in the case . The next proposition provides an explicit formula for the Fourier transform of the kernel (21). Remark that the Fourier transform formulas (28)-(31)-(34) provided in this Appendix can all be deduced from the formulas reported in [47, page 1204] with the change of notation and by simplifying the resulting formulas. We nevertheless provide our more detailed proofs for reference and comprehensiveness, and because the proof can easily be adapted to other kernel functions, as long as the integral , , can be computed analytically (as done for example in [7, subsection 14.3] with , covered here as a corollary in Subsection A.2).
Proposition 3. The Fourier transform of the kernel , , is given by
where denotes the Fox-Wright generalized hypergeometric function with p numerator parameters and q denominator parameters:
Proof. According to equation (24), the Fourier transform of the kernel (21) is given by
Then, we can use the following series representation of the Bessel function [45, equation (8) page 40][10, 10.2.2]:
to obtain
Then, using a change of variable,
which gives
☐
A.2. Symmetric beta kernels
Setting in equation (21) gives the class of multivariate symmetric beta kernels [30, 11]:
which contains the multivariate parabolic, biweight, and triweight kernels (see Table 1).
Corollary 1. The Fourier transform of the kernel , , is given by
where denotes the confluent hypergeometric function with 0 numerator parameter and 1 denominator parameter:
where the rising factorial is defined by .
Proof. Setting in equation (28) gives
☐
A.3. Askey kernels
Setting in equation (21) gives the Askey functions [1]:
which include the multivariate triangular kernel as a particular case (see Table 1).
Corollary 2. The Fourier transform of the kernel , , is given by
where denotes the confluent hypergeometric function with 1 numerator parameter and 2 denominator parameters:
Proof. Setting in equation (28) and using the Legendre duplication formula [10, 5.5.5] gives
after simplifying the multiplicative constant using the Legendre duplication formula again.
Remark 8. Using the Gauss duplication formula [10, 5.5.6] makes it possible to express the Fourier transform (28) in terms of the hypergeometric function whenever where . More precisely,
\begin{aligned}&f(\boldsymbol{x})=\frac{1}{\alpha2^{\frac{d}{2}-1}(2\pi)^{\frac{d}{2}}}\frac{\Gamma(\beta+1)}{\Gamma\left(\frac{d}{2}\right)}\frac{\Gamma\left(\frac{d}{\alpha}\right)}{\Gamma\left(\frac{d}{\alpha}+\beta+1\right)}\sum_{m=0}^{\infty}\frac{\left(-\|\boldsymbol{x}\|^{2}/4\right)^{m}}{m!}\frac{\prod_{k=1}^{n-1}\left(\frac{d}{2}+\frac{k}{n}\right)_{m}}{\prod_{k=0}^{n-1}\left(\frac{d}{2}+\frac{\beta+1}{n}+\frac{k}{n}\right)_{m}}\\ &=\frac{\Gamma(\beta+1)\Gamma\left(\frac{d}{\alpha}\right)}{\alpha2^{\frac{d}{2}-1}(2\pi)^{\frac{d}{2}}\Gamma\left(\frac{d}{2}\right)\Gamma\left(\frac{d}{\alpha}+\beta+1\right)}n^{-1}F_{n}\left(\frac{d+\frac{1}{n},\frac{d}{2}+\frac{2}{n},\ldots,\frac{d}{2}+\frac{n-1}{n};\frac{d}{2}+\frac{\beta+1}{n},\frac{d}{2}+\frac{\beta+2}{n},\ldots,\frac{d}{2}+\frac{\beta+n}{n};-\frac{\|\boldsymbol{x}\|^{2}}{4}\right)\\ \end{aligned} \tag{36}when with . Equation (36) generalizes both equation (31) ( , ) and equation (34) ( , ).