PrefixSpanModel

class pyspark.mllib.fpm.PrefixSpanModel(java_model: py4j.java_gateway.JavaObject)

Model fitted by PrefixSpan

Examples

>>> data = [
...    [["a", "b"], ["c"]],
...    [["a"], ["c", "b"], ["a", "b"]],
...    [["a", "b"], ["e"]],
...    [["f"]]]
>>> rdd = sc.parallelize(data, 2)
>>> model = PrefixSpan.train(rdd)
>>> sorted(model.freqSequences().collect())
[FreqSequence(sequence=[['a']], freq=3), FreqSequence(sequence=[['a'], ['a']], freq=1), ...

Methods

call(name, *a)

Call method of java_model

freqSequences()

Gets frequent sequences

Methods Documentation

call(name: str, *a: Any) → Any

Call method of java_model

freqSequences() → pyspark.rdd.RDD[pyspark.mllib.fpm.PrefixSpan.FreqSequence]

Gets frequent sequences