Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/8061#discussion_r36933109
--- Diff: python/pyspark/ml/feature.py ---
@@ -166,6 +167,62 @@ def getSplits(self):
@inherit_doc
+class ElementwiseProduct(JavaTransformer, HasInputCol, HasOutputCol):
+ """
+ Outputs the Hadamard product (i.e., the element-wise product) of each
input vector
+ with a provided "weight" vector. In other words, it scales each column
of the dataset
+ by a scalar multiplier.
+
+ >>> from pyspark.mllib.linalg import Vectors
+ >>> df = sqlContext.createDataFrame([(Vectors.dense([2.0, 1.0,
3.0]),)], ["values"])
+ >>> ep = ElementwiseProduct(scalingVec=Vectors.dense([1.0, 2.0, 3.0]),
+ ... inputCol="values", outputCol="eprod")
+ >>> ep.transform(df).head().eprod
+ DenseVector([2.0, 2.0, 9.0])
+ >>> ep.setParams(scalingVec=Vectors.dense([2.0, 3.0, 5.0]),
--- End diff --
But you already set the parameter to "eprod" (There aren't really upstream
vs. downstream transformers here; there's only one transformation.)
---
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]