Kernel#
Kernels for filtering, smoothing and stochastics simulations.
An example of Kernel simplification with an Gaussian Filter:
kernel = GaussianKernel(3)
trace.operate(Operator.FILTER, "x", kernel, "x_filtered")
trace.operate(Operator.FILTER, "y", kernel, "y_filtered")
trace.plot(append = False, sym='g-', label='original track')
plt.plot(trace.getAnalyticalFeature("x_filtered"), trace.getAnalyticalFeature("y_filtered"),
'b-', label='simplify:gaussian filter')
plt.legend()

Figure 1: Simplification with a gaussian kernel filter#
- class tracklib.core.Kernel.Kernel(function, support)[source]#
Generic kernel class
- __filter_boundary = False#
TODO
- __kernel_function = None#
TODO
- __support = None#
TODO
- __init__(function, support)[source]#
Kernel constructor
- Parameters
function (
Callable
[[float
],float
]) – Kernel functionsupport (
float
) – Kernel support
- filterBoundary()[source]#
Return the filterBoundary parameter value
- Return type
bool
- Returns
filterBoundary value
- setFunction(function)[source]#
Set the function used by Kernel
- Parameters
function (
Callable
[[float
],float
]) – A kernel function
- getFunction()[source]#
Return the function used by the kernel
- Return type
Callable
[[float
],float
]- Returns
A kernel function
- class tracklib.core.Kernel.UniformKernel(size)[source]#
Define a unifomr kernel
- class tracklib.core.Kernel.TriangularKernel(size)[source]#
Define a triangular kernel
- class tracklib.core.Kernel.GaussianKernel(sigma)[source]#
Define a Gaussian Kernel
- class tracklib.core.Kernel.ExponentialKernel(sigma)[source]#
Define an Exponential Kernel
- class tracklib.core.Kernel.EpanechnikovKernel(size)[source]#
Define a Epanechnikov Kernel
- class tracklib.core.Kernel.SincKernel(size)[source]#
Define a Sinc Kernel
- __init__(size)[source]#
Constructor of a Sinc Kernel
The kernel function is :
\[f(x) = S \cdot \sin \left( \frac{x + \epsilon}{s} \right) \cdot \frac{1}{x + \epsilon} \cdot \frac{1}{\pi \cdot S}\]With \(S\) the scale (\(S = s / 10\)) and \(\epsilon\) a minimal non nul value
- Parameters
s – The size parameter (\(s\)) for the kernel
- class tracklib.core.Kernel.ExperimentalKernel(dmax, method='DTW', r=None)[source]#
Non-parametric estimator of Kernel based on GPS tracks.
The experimental covariogram kernel is initialized with a maximal scope dmax and an optional resolution, both given in ground units as a distance along curvilinear abscissa or traks. The comparison between pairs of tracks is performed with either Nearest Neighbor (NN) or Dynamic Time Warping (DTM) method. Some tests are still to be conducted to determine which one is more suitable for a robust covariance estimation. If no resolution is input, the covariogram is estimated in 30 points as a default value. The covariogram is incrementally estimated with each data input with addSamples (track_collection) or addTrackPair(track1, track2). Note that track collection input into addSamples must contain at least two tracks.
Once an experimental covariogram has been estimated, it is possible to fit a parametric estimation on one of the kernel models provided above (except UniformKernel which is not a positive-definite function). The estimation is performed with fit(kernel) function.
The fitted kernel is returned as standard output.
- __init__(dmax, method='DTW', r=None)[source]#
Constructor of Experimental kernel
- Parameters
dmax (
float
) – TODOmethod (
str
) – TODOr (
Optional
[float
]) – TODO
- __getGamma(scale=1)#
Return gamma value
- Parameters
scale (
int
) – Scale value- Return type
float
- Returns
Gamma value