Vector(DenseVector) as a type?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Vector(DenseVector) as a type?

Daniel Blazevski
Hello,

I am working on the exact knn algorithm in Flink, and I'd like to make the
structure more modular.

​I am working off of the initial work of @chiwanpark, and when I print out
a variable to the screen, I get something like:
```
training.values =  Vector(DenseVector(-0.206, -0.276), DenseVector(-0.206,
-0.076),...,)
testing.values =  Vector((0,DenseVector(0.0, 0.0)))
```
How can I pass such a variable to a function.  It seems that
```
myFun(A : Vector(DenseVector))
myFun(A : Vector[DenseVector])
```
do not work.  Tried to look around other Flink-ml code, but couldn't find
exactly what I was looking for.

Thanks,
Dan
Reply | Threaded
Open this post in threaded view
|

Re: Vector(DenseVector) as a type?

Chiwan Park-2
Hi Daniel,

I think that you are confused about name of classes. Vector in your mail is not org.apache.flink.ml.math.Vector, but scala.collection.immutable.Vector which is immutable collection with random access.

So if you want to create a method which receives that values, you should clarify Vector type. You can import class with renaming like following:

```
import org.apache.flink.ml.math.{Vector => FlinkVector}
```

I hope that this answer helps you. :)

Regards,
Chiwan Park

On November 3, 2015 at 6:11:03 AM, Daniel Blazevski ([hidden email]) wrote:

Hello,  

I am working on the exact knn algorithm in Flink, and I'd like to make the  
structure more modular.  

​I am working off of the initial work of @chiwanpark, and when I print out  
a variable to the screen, I get something like:  
```  
training.values = Vector(DenseVector(-0.206, -0.276), DenseVector(-0.206,  
-0.076),...,)  
testing.values = Vector((0,DenseVector(0.0, 0.0)))  
```  
How can I pass such a variable to a function. It seems that  
```  
myFun(A : Vector(DenseVector))  
myFun(A : Vector[DenseVector])  
```  
do not work. Tried to look around other Flink-ml code, but couldn't find  
exactly what I was looking for.  

Thanks,  
Dan