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

    https://github.com/apache/spark/pull/15415#discussion_r101698275
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/fpm/FPGrowth.scala ---
    @@ -0,0 +1,327 @@
    +/*
    + * 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 scala.collection.mutable.ArrayBuffer
    +import scala.reflect.ClassTag
    +
    +import org.apache.hadoop.fs.Path
    +
    +import org.apache.spark.annotation.{Experimental, Since}
    +import org.apache.spark.ml.{Estimator, Model}
    +import org.apache.spark.ml.param._
    +import org.apache.spark.ml.param.shared.{HasFeaturesCol, HasPredictionCol}
    +import org.apache.spark.ml.util._
    +import org.apache.spark.mllib.fpm.{AssociationRules => 
MLlibAssociationRules,
    +FPGrowth => MLlibFPGrowth}
    +import org.apache.spark.mllib.fpm.FPGrowth.FreqItemset
    +import org.apache.spark.sql._
    +import org.apache.spark.sql.types._
    +
    +/**
    + * Common params for FPGrowth and FPGrowthModel
    + */
    +private[fpm] trait FPGrowthParams extends Params with HasFeaturesCol with 
HasPredictionCol {
    +
    +  /**
    +   * Validates and transforms the input schema.
    +   * @param schema input schema
    +   * @return output schema
    +   */
    +  protected def validateAndTransformSchema(schema: StructType): StructType 
= {
    +    val inputType = schema($(featuresCol)).dataType
    +    require(inputType.isInstanceOf[ArrayType],
    +      s"The input column must be ArrayType, but got $inputType.")
    +    SchemaUtils.appendColumn(schema, $(predictionCol), 
schema($(featuresCol)).dataType)
    +  }
    +
    +  /**
    +   * Minimal support level of the frequent pattern. [0.0, 1.0]. Any 
pattern that appears
    +   * more than (minSupport * size-of-the-dataset) times will be output
    +   * Default: 0.3
    +   * @group param
    +   */
    +  @Since("2.2.0")
    +  val minSupport: DoubleParam = new DoubleParam(this, "minSupport",
    +    "the minimal support level of the frequent pattern (Default: 0.3)",
    +    ParamValidators.inRange(0.0, 1.0))
    +  setDefault(minSupport -> 0.3)
    +
    +  /** @group getParam */
    +  @Since("2.2.0")
    +  def getMinSupport: Double = $(minSupport)
    +
    +  /**
    +   * Number of partitions used by parallel FP-growth
    --- End diff --
    
    Document what it means when this is not set and that this must be >= 1.
    Also say this is not set by default.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to