Repository: spark Updated Branches: refs/heads/master 5ee72454d -> d5ab42ceb
[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 <[email protected]> Closes #12698 from hhbyyh/freqtos. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/d5ab42ce Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/d5ab42ce Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/d5ab42ce Branch: refs/heads/master Commit: d5ab42ceb94feb3645578bf459b104fb0b0d5682 Parents: 5ee7245 Author: Yuhao Yang <[email protected]> Authored: Thu Apr 28 19:52:09 2016 +0100 Committer: Sean Owen <[email protected]> Committed: Thu Apr 28 19:52:09 2016 +0100 ---------------------------------------------------------------------- mllib/src/main/scala/org/apache/spark/mllib/fpm/FPGrowth.scala | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/d5ab42ce/mllib/src/main/scala/org/apache/spark/mllib/fpm/FPGrowth.scala ---------------------------------------------------------------------- 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 4f4996f..9166faa 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" + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
