[ 
https://issues.apache.org/jira/browse/FLINK-1933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14519011#comment-14519011
 ] 

ASF GitHub Bot commented on FLINK-1933:
---------------------------------------

Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/629#discussion_r29320587
  
    --- Diff: 
flink-staging/flink-ml/src/test/scala/org/apache/flink/ml/math/SparseVectorSuite.scala
 ---
    @@ -87,4 +87,33 @@ class SparseVectorSuite extends FlatSpec with Matchers {
     
         sparseVector should not equal(copy)
       }
    +
    +  it should "calculate dot product with SparseVector" in {
    +    val vec1 = SparseVector.fromCOO(4, (0, 1), (1, 0), (2, 1), (3, 0))
    +    val vec2 = SparseVector.fromCOO(4, (0, 0), (1, 1), (2, 0), (3, 1))
    +
    +    vec1.dot(vec2) should be(0)
    +  }
    +
    +  it should "calculate dot product with DenseVector" in {
    +    val vec1 = SparseVector.fromCOO(4, (0, 1), (1, 0), (2, 1), (3, 0))
    +    val vec2 = DenseVector(Array(0, 1, 0, 1))
    +
    +    vec1.dot(vec2) should be(0)
    +  }
    +
    +  it should "fail in case of calculation dot product with different size 
vector" in {
    +    val vec1 = SparseVector.fromCOO(4, (0, 1), (1, 0), (2, 1), (3, 0))
    --- End diff --
    
    continuous non-zero entries


> Add distance measure interface and basic implementation to machine learning 
> library
> -----------------------------------------------------------------------------------
>
>                 Key: FLINK-1933
>                 URL: https://issues.apache.org/jira/browse/FLINK-1933
>             Project: Flink
>          Issue Type: New Feature
>          Components: Machine Learning Library
>            Reporter: Chiwan Park
>            Assignee: Chiwan Park
>              Labels: ML
>
> Add distance measure interface to calculate distance between two vectors and 
> some implementations of the interface. In FLINK-1745, [~till.rohrmann] 
> suggests a interface following:
> {code}
> trait DistanceMeasure {
>   def distance(a: Vector, b: Vector): Double
> }
> {code}
> I think that following list of implementation is sufficient to provide first 
> to ML library users.
> * Manhattan distance [1]
> * Cosine distance [2]
> * Euclidean distance (and Squared) [3]
> * Tanimoto distance [4]
> * Minkowski distance [5]
> * Chebyshev distance [6]
> [1]: http://en.wikipedia.org/wiki/Taxicab_geometry
> [2]: http://en.wikipedia.org/wiki/Cosine_similarity
> [3]: http://en.wikipedia.org/wiki/Euclidean_distance
> [4]: 
> http://en.wikipedia.org/wiki/Jaccard_index#Tanimoto_coefficient_.28extended_Jaccard_coefficient.29
> [5]: http://en.wikipedia.org/wiki/Minkowski_distance
> [6]: http://en.wikipedia.org/wiki/Chebyshev_distance



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to