You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spark.apache.org by techaddict <sa...@techaddict.me> on 2014/04/10 21:56:12 UTC

org.apache.spark.util.Vector is deprecated what next ?

org.apache.spark.util.Vector is deprecated so what should be done to use say
if want to create a vector with zeros, def zeros(length: Int) in util.Vector
using new mllib.linalg.Vector ?



--
View this message in context: http://apache-spark-developers-list.1001551.n3.nabble.com/org-apache-spark-util-Vector-is-deprecated-what-next-tp6288.html
Sent from the Apache Spark Developers List mailing list archive at Nabble.com.

Re: org.apache.spark.util.Vector is deprecated what next ?

Posted by DB Tsai <db...@stanford.edu>.
You can construct the Breeze vector by

    val breezeVector = breeze.linalg.DenseVector.zeros[Double](length)

If you want to convert to mllib vector, you can do

    val mllibVector = Vectors.fromBreeze(breezeVector)

If you want to convert back to breeze vector,

    val newBreezeVector = mllibVector.toBreeze

Sincerely,

DB Tsai
-------------------------------------------------------
My Blog: https://www.dbtsai.com
LinkedIn: https://www.linkedin.com/in/dbtsai


On Thu, Apr 10, 2014 at 1:12 PM, Patrick Wendell <pw...@gmail.com> wrote:
> You'll need to use the associated functionality in Breeze and then create a
> dense vector from a Breeze vector. I have a JIRA for us to update the
> examples for 1.0...  I'm hoping Xiangrui can take a look at it.
>
> https://issues.apache.org/jira/browse/SPARK-1464
>
> https://github.com/scalanlp/breeze/wiki/Breeze-Linear-Algebra
>
>
>
> On Thu, Apr 10, 2014 at 12:56 PM, techaddict <sa...@techaddict.me> wrote:
>
>> org.apache.spark.util.Vector is deprecated so what should be done to use
>> say
>> if want to create a vector with zeros, def zeros(length: Int) in
>> util.Vector
>> using new mllib.linalg.Vector ?
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-spark-developers-list.1001551.n3.nabble.com/org-apache-spark-util-Vector-is-deprecated-what-next-tp6288.html
>> Sent from the Apache Spark Developers List mailing list archive at
>> Nabble.com.
>>

Re: org.apache.spark.util.Vector is deprecated what next ?

Posted by Patrick Wendell <pw...@gmail.com>.
You'll need to use the associated functionality in Breeze and then create a
dense vector from a Breeze vector. I have a JIRA for us to update the
examples for 1.0...  I'm hoping Xiangrui can take a look at it.

https://issues.apache.org/jira/browse/SPARK-1464

https://github.com/scalanlp/breeze/wiki/Breeze-Linear-Algebra



On Thu, Apr 10, 2014 at 12:56 PM, techaddict <sa...@techaddict.me> wrote:

> org.apache.spark.util.Vector is deprecated so what should be done to use
> say
> if want to create a vector with zeros, def zeros(length: Int) in
> util.Vector
> using new mllib.linalg.Vector ?
>
>
>
> --
> View this message in context:
> http://apache-spark-developers-list.1001551.n3.nabble.com/org-apache-spark-util-Vector-is-deprecated-what-next-tp6288.html
> Sent from the Apache Spark Developers List mailing list archive at
> Nabble.com.
>