Compare lists with a bit of fuzz...


    Dec 17 2013 | 11:37 pm
    Can anybody help me with this problem: I want to compare incoming lists of 6 floats (readings from two different movement sensors) with one (or many) previously recorded lists. However, I need the comparison to be done in a fuzzy way, so that you wouldn't need to hit the exact same list for the comparison to be triggered. Basically I need to compare 6 floats to 6 ranges of floats. i was thinking of using a bunch of split objects to define ranges for each of the values, but it seems a bit kludgy to do so. I could imagine this would work with some kind of javascript solution, but I don't really know how to code in javascript. So any idea on how to accomplish this using max objects only would be much appreciated. I have a feeling that the project will be more than heavy on my CPU as well, so any very elegant and computationally cheap solution would be great.

    • Dec 19 2013 | 1:16 pm
      Ok how about using vexpr to subtract the two lists, using abs we can get an absolute value for the differences between the list items.
      'sort -1' will re-arrange the list with the biggest deviation first
      then just chop off the first deviation with 'slice 1' and compare it to your fuzz amount to see if there is a fuzzy match.
    • Dec 19 2013 | 1:24 pm
      @Leafcutter: Wow, that's just sooooo much more elegant than the solution I contrived.... Thanks a lot! For your amusement, here's what I came up with (and will probably discard now :-))
    • Dec 20 2013 | 1:24 am
      Wonderful, there a million and one ways to skin a max cat.
      Once you get into vexpr and the zl objects you can make your life a lot more compact!
    • Dec 20 2013 | 8:30 am
      So it seems :-) Thanks again. Your solution is now the backbone of my patch (with a lot of tweaks and changes, but the basic idea is there...)