Accelerate/vDSP: Meaning of output from vDSP.correlate(_:withKernel:)?

Naïvely, vDSP.correlate(_:withKernel:) from the Apple Accelerate framework looks like the solution to my problem, but I can't make sense of the output values. Either I'm doing it wrong or I'm on a wild goose chase.


Domain

My clients are medical researchers working on methods for characterizing patients' gait from raw accelerometry by matching the data stream against a set of "templates" (their term) for the various characteristics. Target: real-time on iOS.

Their pseudocode appears to slide a snippet ("template;" kernel?) across a data stream looking for goodness-of-fit by correlation coefficient. They've left intermediate steps to function calls. This is for each of several templates, so performance is at a premium. I normalize both data and template to µ = 0.0 and σ = 1.0, which has passed all the unit tests I can think of.

Solution?

As I read the name and the 13-word description, vDSP.correlate(_:withKernel:) does this — in some way. However, the set of numbers that emerge from my playground experiments don't make sense: Identical segments are scored 0.0 (expecting 1.0). Merely similar matches show values barely distinguishable from the rest, and are often well outside the range -1.0 ... 1.0.

Question

Clearly I'm doing it wrong. Web searches don't tell me anything, but I'm naïve on the subject.

  1. Am I mistaken in hoping this vDSP function does what I want? "Yes, you're mistaken" is an acceptable answer. Bonus if you can point me to a correct solution.
  2. If I'm on the right track, how can I generate input I can apply to my needs?


Read more here: https://stackoverflow.com/questions/66339774/accelerate-vdsp-meaning-of-output-from-vdsp-correlate-withkernel

Content Attribution

This content was originally published by Fritz Anderson at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: