[
https://issues.apache.org/jira/browse/SPARK-17400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15464360#comment-15464360
]
Nick Pentreath edited comment on SPARK-17400 at 9/5/16 7:42 AM:
----------------------------------------------------------------
Can you comment more on the performance issue - are you actually seeing this in
practice? From the comment, it seems in most cases zeros in the input vector
would be transformed to non-zeros, so I wonder how much benefit is gained from
a sparse representation?
In any case, it seems like a fairly easy possible win to use
{{SparseVector.compressed}} here (e.g. see
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/Binarizer.scala#L91)
was (Author: mlnick):
Can you comment more on the performance issue - are you actually seeing this in
practice? From the comment, it seems in most cases zeros in the input vector
would be transformed to non-zeros, so I wonder how much benefit is gained from
a sparse representation?
In any case, it seems like a fairly easy possible win to use
`SparseVector.compressed` here (e.g. see
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/Binarizer.scala#L91)
> MinMaxScaler.transform() outputs DenseVector by default, which causes poor
> performance
> --------------------------------------------------------------------------------------
>
> Key: SPARK-17400
> URL: https://issues.apache.org/jira/browse/SPARK-17400
> Project: Spark
> Issue Type: Improvement
> Components: ML, MLlib
> Affects Versions: 1.6.1, 1.6.2, 2.0.0
> Reporter: Frank Dai
>
> MinMaxScaler.transform() outputs DenseVector by default, which will cause
> poor performance and consume a lot of memory.
> The most important line of code is the following:
> https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/MinMaxScaler.scala#L195
> I suggest that the code should calculate the number of non-zero elements in
> advance, if the number of non-zero elements is less than half of the total
> elements in the matrix, use SparseVector, otherwise use DenseVector
> Or we can make it configurable by adding a parameter to
> MinMaxScaler.transform(), for example MinMaxScaler.transform(isDense:
> Boolean), so that users can decide whether their output result is dense or
> sparse.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]