Details

Type: Improvement

Status: In Progress

Priority: Minor

Resolution: Unresolved

Affects Version/s: None

Fix Version/s: None

Component/s: MLlib

Labels:None
Description
MLlib/Vector only support foreachActive function and is short of map/update which is inconvenience for some Vector operations.
For example:
val a = Vectors.dense(...)
If we want to compute math.log for each elements of a and get Vector as return value, we can only code as:
val b = Vectors.dense(a.toArray.map(math.log))
or we can use "toBreeze" and "fromBreeze" make transformation with breeze API.
The code snippet is not elegant, we want it can implement:
val c = a.map(math.log)
Also currently MLlib/Matrix has implemented map/update/foreachActive function. I think Vector should also has map/update.
Issue Links
 is part of

SPARK6442 MLlib Local Linear Algebra Package
 Open
 links to
I think the idea was that this is not supposed to become yet another vector/matrix library, and that you can manipulate the underlying breeze vector if needed. I don't know how strong that convention is. The use case you show doesn't really benefit except for maybe saving a method call; is there a case where this would be a bigger win?