You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by zhengruifeng <gi...@git.apache.org> on 2017/01/05 05:26:38 UTC

[GitHub] spark pull request #15415: [SPARK-14501][ML] spark.ml API for FPGrowth

Github user zhengruifeng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15415#discussion_r94715503
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/fpm/AssociationRules.scala ---
    @@ -0,0 +1,113 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.ml.fpm
    +
    +import org.apache.spark.annotation.{Experimental, Since}
    +import org.apache.spark.ml.param.{DoubleParam, Param, ParamMap, Params}
    +import org.apache.spark.ml.util.Identifiable
    +import org.apache.spark.mllib.fpm.{AssociationRules => MLlibAssociationRules}
    +import org.apache.spark.mllib.fpm.FPGrowth.FreqItemset
    +import org.apache.spark.sql.{DataFrame, Dataset, SparkSession}
    +
    +/**
    + * :: Experimental ::
    + *
    + * Generates association rules from frequent itemsets ("items", "freq"). This method only generates
    + * association rules which have a single item as the consequent.
    + */
    +@Since("2.1.0")
    +@Experimental
    +class AssociationRules(override val uid: String) extends Params {
    +
    +  @Since("2.1.0")
    +  def this() = this(Identifiable.randomUID("AssociationRules"))
    +
    +  /**
    +   * Param for items column name. Items must be array of Integers.
    +   * Default: "items"
    +   * @group param
    +   */
    +  final val itemsCol: Param[String] = new Param[String](this, "itemsCol", "items column name")
    +
    +
    +  /** @group getParam */
    +  @Since("2.1.0")
    +  final def getItemsCol: String = $(itemsCol)
    +
    +  /** @group setParam */
    +  @Since("2.1.0")
    +  def setItemsCol(value: String): this.type = set(itemsCol, value)
    +
    +  /**
    +   * Param for frequency column name. Data type should be Long.
    +   * Default: "freq"
    +   * @group param
    +   */
    +  final val freqCol: Param[String] = new Param[String](this, "freqCol", "frequency column name")
    +
    +
    +  /** @group getParam */
    +  @Since("2.1.0")
    +  final def getFreqCol: String = $(freqCol)
    +
    +  /** @group setParam */
    +  @Since("2.1.0")
    +  def setFreqCol(value: String): this.type = set(freqCol, value)
    +
    +  /**
    +   * Param for minimum confidence, range [0.0, 1.0].
    +   * @group param
    +   */
    +  final val minConfidence: DoubleParam = new DoubleParam(this, "minConfidence", "min confidence")
    --- End diff --
    
    there should be a `ParamValidators.inRange(...)`


---
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