spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mengxr <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-10084] [MLlib] [Doc] Add Python example...
Date Wed, 19 Aug 2015 15:25:52 GMT
Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8279#discussion_r37427896
  
    --- Diff: docs/mllib-frequent-pattern-mining.md ---
    @@ -133,6 +134,36 @@ for (AssociationRules.Rule<String> rule
     {% endhighlight %}
     
     </div>
    +
    +<div data-lang="python" markdown="1">
    +
    +[`FPGrowth`](api/python/pyspark.mllib.html#pyspark.mllib.fpm.FPGrowth) implements the
    +FP-growth algorithm.
    +It take an `RDD` of transactions, where each transaction is an `List` of items of a generic
type.
    +Calling `FPGrowth.train` with transactions returns an
    +[`FPGrowthModel`](api/python/pyspark.mllib.html#pyspark.mllib.fpm.FPGrowthModel)
    +that stores the frequent itemsets with their frequencies. The following
    +example illustrates how to mine frequent itemsets and association rules
    +(see [Association
    +Rules](mllib-frequent-pattern-mining.html#association-rules) for
    +details) from `transactions`.
    +
    +{% highlight python %}
    +from pyspark.mllib.fpm import FPGrowth
    +
    +data = sc.textFile("data/mllib/sample_fpgrowth.txt")
    +
    +transactions = data.map(lambda line: line.strip().split(' '))
    +
    +model = FPGrowth.train(transactions, 0.2, 10)
    --- End diff --
    
    Use named arguments.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message