Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-9003

Add map/update function to MLlib/Vector

    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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                yanboliang Yanbo Liang
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: