-
Notifications
You must be signed in to change notification settings - Fork 1.3k
add Minkowski Distance #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
it('should return 0 with points (0, 1, 4), (1, 1, 6) in order Negative Infinity.', function () { | ||
expect(minkowskiDistance([0, 1, 4], [1, 1, 6], Number.NEGATIVE_INFINITY)).toBe(0); | ||
}); | ||
it('should return 8.372966759705923 with points (0, 3, 4, 5), (7, 6, 3, -1) in order 3.', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description doesn't match the content.
src/others/minkowski-distance.js
Outdated
var i; | ||
|
||
if (lx !== ly) { | ||
throw '2 points must have same array length'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you change it to "Both vectors should have same dimension"?
src/others/minkowski-distance.js
Outdated
} | ||
|
||
if (isNaN(p)) { | ||
throw 'p must be a number'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you change to it "The order "p" must be a number"?
src/others/minkowski-distance.js
Outdated
} else if (p === Number.NEGATIVE_INFINITY) { | ||
return chebyshevDistance(x, y, lx, p, Math.min); | ||
} else if (p < 1) { | ||
throw 'p less than 1 will violate triangle inequality'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you change it to: "Order less than 1 will violate the triangle inequality"?
done with the requested changes. thanks for the review (Y) |
No description provided.