比较两个向量 (Java)
目前我有两个包含 50 多个字符串的较大向量,
我希望能够比较这两个向量并计算出它们的相似程度。我想我需要使用余弦相似度?
有谁知道有什么方法可以接受两个 Java Vector 并给出 0 到 1 之间的值来判断它们的相似程度吗?
谢谢 菲尔
Currently I have two larger vectors of 50+ strings
I want to be able to compare these two Vectors and work out how similar they are. I think I need to use Cosine similarity?
Does anyone know of any methods that take in two Java Vectors and gives a value between 0 and 1 as to how similar they are?
Thanks
Phil
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看相似度函数 在卢森。
的关于此主题的上一个问题。
Have a look at the similarity function in Lucene.
Here's a Previous SO question on this topic.
有关余弦距离和相关方法的实现,请参阅 Apache Mahout 库。还可以考虑查找局部敏感哈希以获得更快的替代方案。
See the Apache Mahout library for implementations of Cosine Distance and related approaches. Also consider looking up Locality Sensitive Hashing for a much speedier alternative.
任何人都可以进行以下
类型推断吗?
Do the following
Type inference, anyone?