[
https://issues.apache.org/jira/browse/SPARK-5116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14267176#comment-14267176
]
Apache Spark commented on SPARK-5116:
-------------------------------------
User 'coderxiang' has created a pull request for this issue:
https://github.com/apache/spark/pull/3919
> Add extractor for SparseVector and DenseVector in MLlib
> --------------------------------------------------------
>
> Key: SPARK-5116
> URL: https://issues.apache.org/jira/browse/SPARK-5116
> Project: Spark
> Issue Type: New Feature
> Components: MLlib
> Reporter: Shuo Xiang
> Priority: Minor
>
> Add extractor for SparseVector and DenseVector in MLlib to save some code
> while performing pattern matching on Vectors. For example, previously we need
> to use:
> vec match {
> case dv: DenseVector =>
> val values = dv.values
> ...
> case sv: SparseVector =>
> val indices = sv.indices
> val values = sv.values
> val size = sv.size
> ...
> }
> with extractor it is:
> vec match {
> case DenseVector(values) =>
> ...
> case SparseVector(size, indices, values) =>
> ...
> }
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]