Fixed many bugs
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
We now empirically evaluate the accuracy of our boxKDE method, using the mean integrated squared error (MISE).
|
||||
The ground truth is given as $N=1000$ synthetic samples drawn from a bivariate mixture normal density $f$
|
||||
The ground truth is given with $N=1000$ synthetic samples drawn from a bivariate mixture normal density $f$
|
||||
\begin{equation}
|
||||
\begin{split}
|
||||
\bm{X} \sim & ~\G{\VecTwo{0}{0}}{0.5\bm{I}} + \G{\VecTwo{3}{0}}{\bm{I}} + \G{\VecTwo{0}{3}}{\bm{I}} \\
|
||||
@@ -21,7 +21,7 @@ Therefore, the particular choice of the ground truth is only of minor importance
|
||||
\end{figure}
|
||||
|
||||
Evaluated at $50^2$ points the exact KDE is compared to the BKDE, boxKDE, and extended box filter approximation, which are evaluated at a smaller grid with $30^2$ points.
|
||||
The MISE between $f$ and the estimates as a function of $h$ are evaluated, and the resulting plot is given in figure~\ref{fig:errorBandwidth}.
|
||||
The MISE between $f$ and the estimates as a function of $h$ are evaluated, and the resulting plot is given in fig.~\ref{fig:errorBandwidth}.
|
||||
A minimum error is obtained with $h=0.35$, for larger oversmoothing occurs and the modes gradually fuse together.
|
||||
|
||||
Both the BKDE and the extended box filter estimate resemble the error curve of the KDE quite well and stable.
|
||||
@@ -42,7 +42,7 @@ However, both cases do not give a deeper insight of the error behavior of our me
|
||||
\begin{figure}[t]
|
||||
%\includegraphics[width=\textwidth,height=6cm]{gfx/tmpPerformance.png}
|
||||
\input{gfx/perf.tex}
|
||||
\caption{Logarithmic plot of the runtime performance with increasing grid size $G$ and bivariate data. The weighted average estimate (blue) performs fastest followed by the boxKDE (orange) approximation. Both the BKDE (red), and the fastKDE (green) are magnitudes slower, especially for $G<10^4$.}\label{fig:performance}
|
||||
\caption{Logarithmic plot of the runtime performance with increasing grid size $G$ and bivariate data. The weighted-average estimate (blue) performs fastest followed by the boxKDE (orange) approximation. Both the BKDE (red) and the fastKDE (green) are magnitudes slower, especially for $G<10^3$.}\label{fig:performance}
|
||||
\end{figure}
|
||||
|
||||
% kde, box filter, exbox in abhänigkeit von h (bild)
|
||||
@@ -53,18 +53,18 @@ However, both cases do not give a deeper insight of the error behavior of our me
|
||||
\subsection{Performance}
|
||||
In the following, we underpin the promising theoretical linear time complexity of our method with empirical time measurements compared to other methods.
|
||||
All tests are performed on a Intel Core \mbox{i5-7600K} CPU with a frequency of \SI{4.2}{\giga\hertz}, and \SI{16}{\giga\byte} main memory.
|
||||
We compare our C++ implementation of the box filter based KDE approximation based on algorithm~\ref{alg:boxKDE} to the \texttt{ks} R package and the fastKDE Python implementation \cite{oBrien2016fast}.
|
||||
The \texttt{ks} packages provides a FFT-based BKDE implementation based on optimized C functions at its core.
|
||||
With state estimation problems in mind, we additionally provide a C++ implementation of a weighted average estimator.
|
||||
As both methods are not using a grid, an equivalent input sample set was used for the weighted average and the fastKDE.
|
||||
We compare our C++ implementation of the boxKDE approximation as shown in algorithm~\ref{alg:boxKDE} to the \texttt{ks} R package and the fastKDE Python implementation \cite{oBrien2016fast}.
|
||||
The \texttt{ks} package provides a FFT-based BKDE implementation based on optimized C functions at its core.
|
||||
With state estimation problems in mind, we additionally provide a C++ implementation of a weighted-average estimator.
|
||||
As both methods are not using a grid, an equivalent input sample set was used for the weighted-average and the fastKDE.
|
||||
|
||||
The results for performance comparison are presented in plot \ref{fig:performance}.
|
||||
The results for performance comparison are presented in fig.~\ref{fig:performance}.
|
||||
% O(N) gut erkennbar für box KDE und weighted average
|
||||
The linear complexity of the boxKDE and the weighted average is clearly visible.
|
||||
% Gerade bei kleinen G bis 10^3 ist die box KDE schneller als R und fastKDE, aber das WA deutlich schneller als alle anderen
|
||||
Especially for small $G$ up to $10^3$ the boxKDE is much faster compared to BKDE and fastKDE.
|
||||
% Bei zunehmend größeren G wird der Abstand zwischen box KDE und WA größer.
|
||||
Nevertheless, the simple weighted average approach performs the fastest and with increasing $G$ the distance to the boxKDE grows constantly.
|
||||
Nevertheless, the simple weighted-average approach performs the fastest and with increasing $G$ the distance to the boxKDE grows constantly.
|
||||
However, it is obvious that this comes with major disadvantages, like being prone to multimodalities, as discussed in section \ref{sec:intro}.
|
||||
% (Das kann auch daran liegen, weil das Binning mit größeren G langsamer wird, was ich mir aber nicht erklären kann! Vlt Cache Effekte)
|
||||
|
||||
@@ -74,7 +74,7 @@ Further looking at fig. \ref{fig:performance}, the runtime performance of the BK
|
||||
% Dies kommt durch die FFT. Der Input in für die FFT muss immer auf die nächste power of two gerundet werden.
|
||||
This behavior is caused by the underlying FFT algorithm.
|
||||
% Daher wird die Laufzeit sprunghaft langsamer wenn auf eine neue power of two aufgefüllt wird, ansonsten bleibt sie konstant.
|
||||
The FFT approach requires the input to be always rounded up to a power of two, what then causes a constant runtime behavior within those boundaries and a strong performance deterioration at corresponding manifolds.
|
||||
The FFT approach requires the input to be always rounded up to a power of two, what then causes a constant runtime behaviour within those boundaries and a strong performance deterioration at corresponding manifolds.
|
||||
% Der Abbruch bei G=4406^2 liegt daran, weil für größere Gs eine out of memory error ausgelöst wird.
|
||||
The termination of BKDE graph at $G=4406^2$ is caused by an out of memory error for even bigger $G$ in the \texttt{ks} package.
|
||||
|
||||
@@ -85,10 +85,10 @@ Both discussed Gaussian filter approximations, namely box filter and extended bo
|
||||
While the average runtime over all values of $G$ for the standard box filter is \SI{0.4092}{\second}, the extended one provides an average of \SI{0.4169}{\second}.
|
||||
To keep the arrangement of fig. \ref{fig:performance} clear, we only illustrated the results of the boxKDE with the regular box filter.
|
||||
|
||||
The weighted average has the great advantage of being independent of the dimensionality of the input and effortlessly implemented.
|
||||
The weighted-average has the great advantage of being independent of the dimensionality of the input and can be implemented effortlessly.
|
||||
In contrast, the computation of the boxKDE approach increases exponentially with increasing number of dimensions.
|
||||
However, due to the linear time complexity and the very simple computation scheme, the overall computation time is still sufficient fast for many applications and much smaller compared to other methods.
|
||||
The boxKDE approach presents a reasonable alternative to the weighted average and is easily integrated into existing systems.
|
||||
The boxKDE approach presents a reasonable alternative to the weighted-average and is easily integrated into existing systems.
|
||||
|
||||
In addition, modern CPUs do benefit from the recursive computation scheme of the box filter, as the data exhibits a high degree of spatial locality in memory and the accesses are reliable predictable.
|
||||
Furthermore, the computation is easily parallelized, as there is no data dependency between the one-dimensional filter passes in algorithm~\ref{alg:boxKDE}.
|
||||
|
||||
Reference in New Issue
Block a user