You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by WeichenXu123 <gi...@git.apache.org> on 2017/08/07 18:54:24 UTC

[GitHub] spark pull request #18798: [WIP] [SPARK-19634][ML] Multivariate summarizer -...

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

    https://github.com/apache/spark/pull/18798#discussion_r131735748
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/stat/Summarizer.scala ---
    @@ -547,35 +533,11 @@ object SummaryBuilderImpl extends Logging {
           // val features = udt.deserialize(featuresExpr.eval(row))
           val featuresDatum = featuresExpr.eval(row).asInstanceOf[InternalRow]
     
    -      val isDense = featuresDatum.getByte(0) == 1
    -
    -      val indices: ArrayData = if (isDense) null else featuresDatum.getArray(2)
    -      val values: ArrayData = featuresDatum.getArray(3)
    -      val _size = if (isDense) values.numElements() else featuresDatum.getInt(1)
    -
    -      val features = new TraversableIndexedSeq {
    -
    -        override def foreachActive(f: (Int, Double) => Unit): Unit = {
    -          var i = 0
    -          if (isDense) {
    -            while (i < _size) {
    -              f(i, values.getDouble(i))
    -              i += 1
    -            }
    -          } else {
    -            while (i < indices.numElements()) {
    -              f(indices.getInt(i), values.getDouble(i))
    -              i += 1
    -            }
    -          }
    -        }
    -
    -        override def size: Int = _size
    -      }
    +      val features = udt.deserialize(featuresDatum)
    --- End diff --
    
    Change to use `VectorUDT.deserialize` (Because last version code here won't improve performance markedly but increase code complexity.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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