1 #NOTE: always keep ID in first column
2 curvesToCoeffs = function(series, wf)
6 D = ceiling( log(L-1) )
8 #TODO: parallel::parApply() ?!
9 res = apply(series, 1, function(x) {
10 interpolated_curve = spline(1:(L-1), x[2:L], n=nb_sample_points)$y
11 W = wavelets::dwt(interpolated_curve, filter=wf, D)@W
12 nrj_coeffs = rev( sapply( W, function(v) ( sqrt( sum(v^2) ) ) ) )
13 return ( c(x[1], nrj_coeffs) )
15 return (as.data.frame(res))
18 getClusters = function(data, K)
21 pam_output = cluster::pam(data, K)
22 return ( list( clusts=pam_output$clustering, medoids=pam_output$medoids,
23 ranks=pam_output$id.med ) )