Compare lists with a bit of fuzz…

Dec 17, 2013 at 3:37pm

Compare lists with a bit of fuzz…

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.

#276043
Dec 19, 2013 at 5:16am

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.

<code>

– Pasted Max Patch, click to expand. –

</code>

#276204
Dec 19, 2013 at 5:24am

@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 :-))

<code>

– Pasted Max Patch, click to expand. –

</code>

#276205
Dec 19, 2013 at 5:24pm

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!

#276257
Dec 20, 2013 at 12:30am

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…)

#276271

You must be logged in to reply to this topic.