[ https://issues.apache.org/jira/browse/SPARK-22195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16193844#comment-16193844 ]
yuhao yang edited comment on SPARK-22195 at 10/6/17 7:33 AM: ------------------------------------------------------------- Thanks for the feedback. I don't see the existing implementation (RowMatrix or in Word2Vec) can fulfill the two scenarios: 1. Compute cosine similarity between two arbitrary vectors. 2. Compute cosine similarity between one vector and a group of other Vectors (usually candidates). And I'm afraid that not everyone using Spark ML knows how to implement cosine similarity. was (Author: yuhaoyan): Thanks for the feedback. I don't see the existing implementation (RowMatrix or in Word2Vec) can fulfill the two scenarios: 1. Compute cosine similarity between two arbitrary vectors. 2. Compute cosine similarity between one vector and a group of other Vectors (usually candidates). And again, not everyone using Spark ML know how to implement cosine similarity. > Add cosine similarity to org.apache.spark.ml.linalg.Vectors > ----------------------------------------------------------- > > Key: SPARK-22195 > URL: https://issues.apache.org/jira/browse/SPARK-22195 > Project: Spark > Issue Type: New Feature > Components: ML > Affects Versions: 2.2.0 > Reporter: yuhao yang > Priority: Minor > > https://en.wikipedia.org/wiki/Cosine_similarity: > As the most important measure of similarity, I found it quite useful in some > image and NLP applications according to personal experience. > Suggest to add function for cosine similarity in > org.apache.spark.ml.linalg.Vectors. > Interface: > def cosineSimilarity(v1: Vector, v2: Vector): Double = ... > def cosineSimilarity(v1: Vector, v2: Vector, norm1: Double, norm2: Double): > Double = ... > Appreciate suggestions and need green light from committers. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org