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

    https://github.com/apache/spark/pull/6112#discussion_r32049209
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/mllib/linalg/VectorsSuite.scala ---
    @@ -63,11 +63,49 @@ class VectorsSuite extends FunSuite {
         assert(vec.toArray.eq(arr))
       }
     
    +  test("dense argmax") {
    +    val vec = Vectors.dense(Array.empty[Double]).asInstanceOf[DenseVector]
    +    assert(vec.argmax === -1)
    +
    +    val vec2 = Vectors.dense(arr).asInstanceOf[DenseVector]
    +    assert(vec2.argmax === 3)
    +
    +    val vec3 = Vectors.dense(Array(-1.0, 0.0, -2.0, 
1.0)).asInstanceOf[DenseVector]
    +    assert(vec3.argmax === 3)
    +  }
    +
       test("sparse to array") {
         val vec = Vectors.sparse(n, indices, values).asInstanceOf[SparseVector]
         assert(vec.toArray === arr)
       }
     
    +  test("sparse argmax") {
    +    val vec = 
Vectors.sparse(0,Array.empty[Int],Array.empty[Double]).asInstanceOf[SparseVector]
    +    assert(vec.argmax === -1)
    +
    +    val vec2 = Vectors.sparse(n,indices,values).asInstanceOf[SparseVector]
    +    assert(vec2.argmax === 3)
    +
    +    val vec3 = Vectors.sparse(5,Array(2, 3, 4),Array(1.0, 0.0, -.7))
    --- End diff --
    
    nitpick: spaces after comma.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to