huaxingao commented on a change in pull request #26035:
[SPARK-29360][PYTHON][ML] PySpark FPGrowthModel supports getter/setter
URL: https://github.com/apache/spark/pull/26035#discussion_r331798860
##########
File path: python/pyspark/ml/fpm.py
##########
@@ -197,20 +171,22 @@ class FPGrowth(JavaEstimator, HasItemsCol,
HasPredictionCol,
| [r]| 3|
+---------+----+
only showing top 5 rows
+ ...
>>> fpm.associationRules.show(5)
- +----------+----------+----------+
- |antecedent|consequent|confidence|
- +----------+----------+----------+
- | [t, s]| [y]| 1.0|
- | [t, s]| [x]| 1.0|
- | [t, s]| [z]| 1.0|
- | [p]| [r]| 1.0|
- | [p]| [z]| 1.0|
- +----------+----------+----------+
+ +----------+----------+----------+----+
+ |antecedent|consequent|confidence|lift|
+ +----------+----------+----------+----+
+ | [t, s]| [y]| 1.0| 2.0|
+ | [t, s]| [x]| 1.0| 1.5|
+ | [t, s]| [z]| 1.0| 1.2|
+ | [p]| [r]| 1.0| 2.0|
+ | [p]| [z]| 1.0| 1.2|
+ +----------+----------+----------+----+
only showing top 5 rows
+ ...
>>> new_data = spark.createDataFrame([(["t", "s"], )], ["items"])
- >>> sorted(fpm.transform(new_data).first().prediction)
- ['x', 'y', 'z']
+ >>> sorted(fpm.transform(new_data).first().newPrediction)
+ [u'x', u'y', u'z']
Review comment:
Because I added ```fpm.setPredictionCol("newPrediction")``` to test the
newly added ```setPredictionCol``` on ```FPGrowthModel```, now the
predictionCol is ```newPrediction``` instead of ```prediction```.
The [u'string'] change is not because of the predictionCol sets to
```newPrediction```. It is to fix the existing problem. Seems the doctests have
never run before, so the problem was never caught.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]