将文本文件转换为PrefixSpan的输入格式以在Spark Mllib中使用

时间:2017-06-22 16:01:14

标签: apache-spark apache-spark-mllib prefix

我有sample.txt:

1 2 3
1 3 2 1 2
1 2 5
6

我需要将此转换为Feed作为prefixSpan mllib Spark的输入,

http://spark.apache.org/docs/latest/mllib-frequent-pattern-mining.html

我用过

val data = sc.textFile("...")
data.map(_.split(' ').map(s => Array(s.toInt)))

但是当我运行

时,我遇到了以下错误
<console>:36: error: inferred type arguments [Nothing,Nothing,org.apache.spark.rdd.RDD[Array[Array[String]]]] do not conform to method run's type parameter bounds [Item,Itemset <: Iterable[Item],Sequence <: Iterable[Itemset]]
         val model = prefixSpan.run(sequences)

0 个答案:

没有答案