agarie / measurable Goto Github PK
View Code? Open in Web Editor NEWVarious distance and similarity measures for machine learning.
License: MIT License
Various distance and similarity measures for machine learning.
License: MIT License
The output of Measurable.jaccard_index
appears to be inconsistent with what I might expect coming from other implementations:
$ pry --gem
[1] pry(main)> u = [1, 0, 1]
=> [1, 0, 1]
[2] pry(main)> v = [1, 1, 1]
=> [1, 1, 1]
[3] pry(main)> Measurable.jaccard_index(u, v)
=> 0.6666666666666666
[4] pry(main)> Measurable.jaccard_index(v, u)
=> 0.6666666666666666
[5] pry(main)> require 'distance_measures'
=> true
[6] pry(main)> u.jaccard_index(v)
=> 0.5
[7] pry(main)> v.jaccard_index(u)
=> 0.5
[8] pry(main)> require 'jaccard'
=> true
from (pry):9:in `__pry__'
[9] pry(main)> Jaccard.coefficient(u, v)
=> 0.5
[10] pry(main)> Jaccard.coefficient(v, u)
=> 0.5
$ python
>>> import distance
>>> u = [1, 0, 1]
>>> v = [1, 1, 1]
>>> 1 - distance.jaccard(u, v)
0.5
Am I misunderstanding the intent of Measurable.jaccard_index
?, Otherwise, I could provide a patch with a fix.
I was thinking about the library for metrics as well and found your repo. I guess that it would be cool to make this gem look like it should be.
As I see, the development cycle of NMatrix is not as short as in case of this gem. The demand for this gem is pretty high. Nobody cares about NMatrix. People care about tasty Array mixin with C bindings. There should be a product like this.
Please, tell me if you plan to support this library. It seems strange for me to make a new gem with similar features. As far as I work with ML issues in the context of Ajaila. I'd like to make it a part of family of Ajaila extensions.
Would you like to make this gem a part of Ajaila ecosystem? Or I can make a fork and continue on my own. Both variants are fine.
Best,
Max
It'd be pretty cool to require specific methods, e.g. require 'measurable/cosine'
.
It's easy to do this now because it's equivalent to requiring specific Ruby files. However, when C bindings to optimized methods are added, I don't know how I'll handle this.
Anyway.
Some companies will only use gems with a certain license.
The canonical and easy way to check is via the gemspec,
via e.g.
spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']
Even for projects that already specify a license, including a license in your gemspec is a good practice, since it is easily
discoverable there without having to check the readme or for a license file. For example, it is the field that rubygems.org uses to display a gem's license.
For example, there is a License Finder gem to help companies ensure all gems they use
meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough
issue that even Bundler now generates gems with a default 'MIT' license.
If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), github has created a license picker tool.
In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :).
I hope you'll consider specifying a license in your gemspec. If not, please just close the issue and let me know. In either case, I'll follow up. Thanks!
p.s. I've written a blog post about this project
Each metric must have one or two examples and links to articles or, at the very least, a Wikipedia entry explaining what it's about.
A short explanation for each one, maybe with examples of where it's mainly used, is a good idea as well.
Create exceptions for when the vectors have different sizes (e.g. DiffLengthException
).
Is there any other case?
Each metric should be tested on arrays and nvectors and show some calculations (preferably with "real" inputs). Also, whenever possible, one or more specs confirming some mathematical property.
In my work I need to use distance function which needs to be initialized with some data. As an example of such distance I can name https://en.wikipedia.org/wiki/Mahalanobis_distance . It needs to be initialized with covariance matrix. Since distances in your lib is just functions, it is impossible to do. Can you suggest any ideas to implement such initialization? Or, if you are interested in, can I offer my assistance with object reimplementation of distance functions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.