Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4580#discussion_r29816049
  
    --- Diff: docs/mllib-feature-extraction.md ---
    @@ -477,3 +477,76 @@ sc.stop();
     </div>
     </div>
     
    +## ElementwiseProduct
    +
    +ElementwiseProduct multiplies individual vector samples by a provided 
weighting vector component-wise.  This represents the [Hadamard 
product](https://en.wikipedia.org/wiki/Hadamard_product_%28matrices%29) between 
the input vector, `v` and transforming vector, `w`, to yield a result vector.
    +
    +`\[ \begin{pmatrix}
    +v_1 \\
    +\vdots \\
    +v_N
    +\end{pmatrix} \circ \begin{pmatrix}
    +                    w_1 \\
    +                    \vdots \\
    +                    w_N
    +                    \end{pmatrix}
    += \begin{pmatrix}
    +  v_1 w_1 \\
    +  \vdots \\
    +  v_N w_N
    +  \end{pmatrix}
    +\]`
    +
    
+[`ElementwiseProduct`](api/scala/index.html#org.apache.spark.mllib.feature.ElementwiseProduct)
 has the following parameter in the constructor:
    +
    +* `w` Vector, the transforming vector.
    +
    +`ElementwiseProduct` implements 
[`VectorTransformer`](api/scala/index.html#org.apache.spark.mllib.feature.VectorTransformer)
 which can apply the weighting on a `Vector` to produce a transformed `Vector` 
or on an `RDD[Vector]` to produce a transformed `RDD[Vector]`.
    +
    +### Example
    +
    +This example below demonstrates how to load a simple vectors file, extract 
a set of vectors, then transform those vectors using a transforming vector 
value.
    +
    +
    +<div class="codetabs">
    +<div data-lang="scala">
    +{% highlight scala %}
    +import org.apache.spark.SparkContext._
    +import org.apache.spark.mllib.feature.ElementwiseProduct
    +import org.apache.spark.mllib.linalg.Vectors
    +
    +//load and parse the data
    +val data = sc.textFile("data/mllib/kmeans_data.txt")
    +val parsedData = data.map(s => Vectors.dense(s.split(' ').map(_.toDouble)))
    +
    +val transformingVector = Vectors.dense(0.0, 1.0, 2.0)
    +val transformer = new ElementwiseProduct(transformingVector)
    +
    +//same results:
    --- End diff --
    
    Add space here too: ```// same```
    
    Also, can this doc please be more explicit?
    ```
    // Batch transform and per-row transform give the same results.
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to