node-nearest-neighbor
node-nearest-neighbor copied to clipboard
Allow for customArgs
Add custom args so that custom comparison methods can provide more args such as max etc.
Fields would change to.
var fields = [
{ name: "x", measure: nn.comparisonMethods.custom, args: {max: 10} },
{ name: "y", measure: nn.comparisonMethods.custom, args: {max: 10} }
];
custom comparison mathods would be
nn.comparisonMethods.custom = function(a, b, args) {
// Test for args and enforce defaults...
// compare something...
var value = ...
return value; // between 0 and 1
};