From 0772026c2fc88aa85423034006b758f6ff0cc2ed Mon Sep 17 00:00:00 2001 From: rahulpalamuttam Date: Fri, 10 Jul 2015 16:07:31 -0700 Subject: [SPARK-8923] [DOCUMENTATION, MLLIB] Add @since tags to mllib.fpm Author: rahulpalamuttam Closes #7341 from rahulpalamuttam/TaggingMLlibfpm and squashes the following commits: bef2843 [rahulpalamuttam] fix @since tags in mmlib.fpm cd86252 [rahulpalamuttam] Add @since tags to mllib.fpm --- .../org/apache/spark/mllib/fpm/AssociationRules.scala | 10 ++++++++++ .../scala/org/apache/spark/mllib/fpm/FPGrowth.scala | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) (limited to 'mllib') diff --git a/mllib/src/main/scala/org/apache/spark/mllib/fpm/AssociationRules.scala b/mllib/src/main/scala/org/apache/spark/mllib/fpm/AssociationRules.scala index 7e2bbfe31c..72d0ea0c12 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/fpm/AssociationRules.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/fpm/AssociationRules.scala @@ -31,6 +31,8 @@ import org.apache.spark.rdd.RDD * * Generates association rules from a [[RDD[FreqItemset[Item]]]. This method only generates * association rules which have a single item as the consequent. + * + * @since 1.5.0 */ @Experimental class AssociationRules private[fpm] ( @@ -38,11 +40,15 @@ class AssociationRules private[fpm] ( /** * Constructs a default instance with default parameters {minConfidence = 0.8}. + * + * @since 1.5.0 */ def this() = this(0.8) /** * Sets the minimal confidence (default: `0.8`). + * + * @since 1.5.0 */ def setMinConfidence(minConfidence: Double): this.type = { require(minConfidence >= 0.0 && minConfidence <= 1.0) @@ -54,6 +60,8 @@ class AssociationRules private[fpm] ( * Computes the association rules with confidence above [[minConfidence]]. * @param freqItemsets frequent itemset model obtained from [[FPGrowth]] * @return a [[Set[Rule[Item]]] containing the assocation rules. + * + * @since 1.5.0 */ def run[Item: ClassTag](freqItemsets: RDD[FreqItemset[Item]]): RDD[Rule[Item]] = { // For candidate rule X => Y, generate (X, (Y, freq(X union Y))) @@ -90,6 +98,8 @@ object AssociationRules { * @param antecedent hypotheses of the rule * @param consequent conclusion of the rule * @tparam Item item type + * + * @since 1.5.0 */ @Experimental class Rule[Item] private[fpm] ( 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 9cb9a00dbd..e2370a52f4 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 @@ -38,12 +38,15 @@ import org.apache.spark.storage.StorageLevel * Model trained by [[FPGrowth]], which holds frequent itemsets. * @param freqItemsets frequent itemset, which is an RDD of [[FreqItemset]] * @tparam Item item type + * + * @since 1.3.0 */ @Experimental class FPGrowthModel[Item: ClassTag](val freqItemsets: RDD[FreqItemset[Item]]) extends Serializable { /** * Generates association rules for the [[Item]]s in [[freqItemsets]]. * @param confidence minimal confidence of the rules produced + * @since 1.5.0 */ def generateAssociationRules(confidence: Double): RDD[AssociationRules.Rule[Item]] = { val associationRules = new AssociationRules(confidence) @@ -67,6 +70,8 @@ class FPGrowthModel[Item: ClassTag](val freqItemsets: RDD[FreqItemset[Item]]) ex * * @see [[http://en.wikipedia.org/wiki/Association_rule_learning Association rule learning * (Wikipedia)]] + * + * @since 1.3.0 */ @Experimental class FPGrowth private ( @@ -76,11 +81,15 @@ class FPGrowth private ( /** * Constructs a default instance with default parameters {minSupport: `0.3`, numPartitions: same * as the input data}. + * + * @since 1.3.0 */ def this() = this(0.3, -1) /** * Sets the minimal support level (default: `0.3`). + * + * @since 1.3.0 */ def setMinSupport(minSupport: Double): this.type = { this.minSupport = minSupport @@ -89,6 +98,8 @@ class FPGrowth private ( /** * Sets the number of partitions used by parallel FP-growth (default: same as input data). + * + * @since 1.3.0 */ def setNumPartitions(numPartitions: Int): this.type = { this.numPartitions = numPartitions @@ -99,6 +110,8 @@ class FPGrowth private ( * Computes an FP-Growth model that contains frequent itemsets. * @param data input data set, each element contains a transaction * @return an [[FPGrowthModel]] + * + * @since 1.3.0 */ def run[Item: ClassTag](data: RDD[Array[Item]]): FPGrowthModel[Item] = { if (data.getStorageLevel == StorageLevel.NONE) { @@ -199,6 +212,8 @@ class FPGrowth private ( /** * :: Experimental :: + * + * @since 1.3.0 */ @Experimental object FPGrowth { @@ -208,11 +223,15 @@ object FPGrowth { * @param items items in this itemset. Java users should call [[FreqItemset#javaItems]] instead. * @param freq frequency * @tparam Item item type + * + * @since 1.3.0 */ class FreqItemset[Item](val items: Array[Item], val freq: Long) extends Serializable { /** * Returns items in a Java List. + * + * @since 1.3.0 */ def javaItems: java.util.List[Item] = { items.toList.asJava -- cgit v1.2.3