diff options
author | Yuhao Yang <hhbyyh@gmail.com> | 2016-04-28 19:52:09 +0100 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2016-04-28 19:52:09 +0100 |
commit | d5ab42ceb94feb3645578bf459b104fb0b0d5682 (patch) | |
tree | bf57a0e20fdfdcfa6c6647085ab9dbc14a13338a /mllib/src/main | |
parent | 5ee72454df21ef4668c855134627d0cdf5d35132 (diff) | |
download | spark-d5ab42ceb94feb3645578bf459b104fb0b0d5682.tar.gz spark-d5ab42ceb94feb3645578bf459b104fb0b0d5682.tar.bz2 spark-d5ab42ceb94feb3645578bf459b104fb0b0d5682.zip |
[SPARK-14916][MLLIB] A more friendly tostring for FreqItemset in mllib.fpm
## What changes were proposed in this pull request?
jira: https://issues.apache.org/jira/browse/SPARK-14916
FreqItemset as the result of FPGrowth should have a more friendly toString(), to help users and developers.
sample:
{a, b}: 5
{x, y, z}: 4
## How was this patch tested?
existing unit tests.
Author: Yuhao Yang <hhbyyh@gmail.com>
Closes #12698 from hhbyyh/freqtos.
Diffstat (limited to 'mllib/src/main')
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/mllib/fpm/FPGrowth.scala | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/fpm/FPGrowth.scala b/mllib/src/main/scala/org/apache/spark/mllib/fpm/FPGrowth.scala index 4f4996f3be..9166faa54d 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/fpm/FPGrowth.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/fpm/FPGrowth.scala @@ -327,5 +327,9 @@ object FPGrowth { def javaItems: java.util.List[Item] = { items.toList.asJava } + + override def toString: String = { + s"${items.mkString("{", ",", "}")}: $freq" + } } } |