distFrechet(Px,Py,Qx, Qy, timeScale=0.1, FrechetSumOrMax = "sum")
distFrechetR(Px,Py,Qx, Qy, timeScale=0.1, FrechetSumOrMax = "sum")
distFrechetRec(Px,Py,Qx, Qy, timeScale=0.1, FrechetSumOrMax = "sum")
numeric
]: allow to modify the time scale,
increasing or decreasing the cost of the horizontal shift. If timeScale is
very big, then the Frechet's distance is equal to the
euclidienne distance. If timeScale is very small, then it is equal to
the Dynamic Time Warping.character
]: The Frechet's distance can
be define using the 'sum' function or the 'max' function. This option
let the user to chose one or the other.inf_{a,b} max_{t} d(P(a(t)),Q(b(t)))
. It's computation is a
NP-complex problem. When P and Q are trajectories (discrete curve), the
problem is polynomial. The Frechet distance can also be define using a sum instead of a max:
inf_{a,b} sum_{t} d(P(a(t)),Q(b(t)))
The function distFrechet
is C compiled,
the function distFrechetR
is in R,
the function distFrechetRec
is in recursive (the slowest) in R.
[2] C. Genolini and B. Falissard "KmL: k-means for longitudinal data" Computational Statistics, vol 25(2), pp 317-328, 2010
[3] C. Genolini and B. Falissard "KmL: A package to cluster longitudinal data" Computer Methods and Programs in Biomedicine, 104, pp e112-121, 2011
Px <- 1:20
Py <- dnorm(1:20,12,2)
Qx <- 1:20
Qy <- dnorm(1:20,8,2)
### Function from Eiter and Mannila compiled in C
system.time(cat("\n",distFrechet(Px,Py,Qx,Qy)))
### Same thing in R
system.time(cat("\n",distFrechetR(Px,Py,Qx,Qy)))
### Frechet using sum instead of max.
distFrechet(Px,Py,Qx,Qy,FrechetSumOrMax="sum")
Run the code above in your browser using DataLab