pyspark-Frequent Pattern Mining

来源:互联网 发布:hadoop mac 安装 编辑:程序博客网 时间:2024/05/16 15:50

参考地址:

1、http://spark.apache.org/docs/latest/ml-guide.html

2、https://github.com/apache/spark/tree/v2.2.0

3、http://spark.apache.org/docs/latest/ml-frequent-pattern-mining.html



from pyspark.ml.fpm import FPGrowthdf = spark.createDataFrame([    (0, [1, 2, 5]),    (1, [1, 2, 3, 5]),    (2, [1, 2])], ["id", "items"])fpGrowth = FPGrowth(itemsCol="items", minSupport=0.5, minConfidence=0.6)model = fpGrowth.fit(df)# Display frequent itemsets.model.freqItemsets.show()# Display generated association rules.model.associationRules.show()# transform examines the input items against all the association rules and summarize the# consequents as predictionmodel.transform(df).show()


阅读全文
0 0
原创粉丝点击