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

    https://github.com/apache/spark/pull/6008#discussion_r30756626
  
    --- Diff: docs/mllib-feature-extraction.md ---
    @@ -527,6 +527,33 @@ val transformedData2 = parsedData.map(x => 
transformer.transform(x))
     
     {% endhighlight %}
     </div>
    +
    +<div data-lang="java">
    +{% highlight java %}
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.mllib.feature.ElementwiseProduct;
    +import org.apache.spark.mllib.linalg.Vector;
    +import org.apache.spark.mllib.linalg.Vectors;
    +
    +// Create some vector data; also works for sparse vectors
    +JavaRDD<Vector> data = sc.parallelize(Arrays.asList(
    +  Vectors.dense(1.0, 2.0, 3.0), Vectors.dense(4.0, 5.0, 6.0)));
    +Vector transformingVector = Vectors.dense(0.0, 1.0, 2.0);
    +ElementwiseProduct transformer = new 
ElementwiseProduct(transformingVector);
    +
    +// Batch transform and per-row transform give the same results:
    +JavaRDD<Vector> transformedData = transformer.transform(data);
    +JavaRDD<Vector> transformedData2 = data.map(
    +  new Function<Vector, Vector>() {
    +    public Vector call(Vector v) {
    --- End diff --
    
    Need ```@Override``` annotation.  (See other Java examples)


---
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