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

    https://github.com/apache/spark/pull/5626#discussion_r28987593
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/classification/GBTClassifier.scala ---
    @@ -0,0 +1,225 @@
    +/*
    + * 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.classification
    +
    +import com.github.fommil.netlib.BLAS.{getInstance => blas}
    +
    +import org.apache.spark.Logging
    +import org.apache.spark.annotation.AlphaComponent
    +import org.apache.spark.ml.impl.estimator.{PredictionModel, Predictor}
    +import org.apache.spark.ml.impl.tree._
    +import org.apache.spark.ml.param.{Param, Params, ParamMap}
    +import org.apache.spark.ml.regression.DecisionTreeRegressionModel
    +import org.apache.spark.ml.tree.{DecisionTreeModel, TreeEnsembleModel}
    +import org.apache.spark.ml.util.MetadataUtils
    +import org.apache.spark.mllib.linalg.Vector
    +import org.apache.spark.mllib.regression.LabeledPoint
    +import org.apache.spark.mllib.tree.{GradientBoostedTrees => OldGBT}
    +import org.apache.spark.mllib.tree.configuration.{Algo => OldAlgo}
    +import org.apache.spark.mllib.tree.loss.{Loss => OldLoss, LogLoss => 
OldLogLoss}
    +import org.apache.spark.mllib.tree.model.{GradientBoostedTreesModel => 
OldGBTModel}
    +import org.apache.spark.rdd.RDD
    +import org.apache.spark.sql.DataFrame
    +
    +
    +/**
    + * :: AlphaComponent ::
    + *
    + * [[http://en.wikipedia.org/wiki/Gradient_boosting Gradient-Boosted Trees 
(GBTs)]]
    + * learning algorithm for classification.
    + * It supports binary labels, as well as both continuous and categorical 
features.
    + * Note: Multiclass labels are not currently supported.
    + */
    +@AlphaComponent
    +final class GBTClassifier
    +  extends Predictor[Vector, GBTClassifier, GBTClassificationModel]
    +  with GBTParams with TreeClassifierParams with Logging {
    +
    +  // Override parameter setters from parent trait for Java API 
compatibility.
    +
    +  // Parameters from TreeClassifierParams:
    +
    +  override def setMaxDepth(value: Int): this.type = 
super.setMaxDepth(value)
    +
    +  override def setMaxBins(value: Int): this.type = super.setMaxBins(value)
    +
    +  override def setMinInstancesPerNode(value: Int): this.type =
    +    super.setMinInstancesPerNode(value)
    +
    +  override def setMinInfoGain(value: Double): this.type = 
super.setMinInfoGain(value)
    +
    +  override def setMaxMemoryInMB(value: Int): this.type = 
super.setMaxMemoryInMB(value)
    +
    +  override def setCacheNodeIds(value: Boolean): this.type = 
super.setCacheNodeIds(value)
    +
    +  override def setCheckpointInterval(value: Int): this.type = 
super.setCheckpointInterval(value)
    +
    +  /**
    +   * The impurity setting is ignored for GBT models.
    +   * Individual trees are built using impurity "Variance."
    +   */
    +  override def setImpurity(value: String): this.type = {
    +    logWarning("GBTClassifier.setImpurity should NOT be used")
    +    this
    +  }
    +
    +  // Parameters from TreeEnsembleParams:
    +
    +  override def setSubsamplingRate(value: Double): this.type = 
super.setSubsamplingRate(value)
    +
    +  override def setSeed(value: Long): this.type = {
    +    logWarning("The 'seed' parameter is currently ignored by Gradient 
Boosting.")
    +    super.setSeed(value)
    +  }
    +
    +  // Parameters from GBTParams:
    +
    +  override def setMaxIter(value: Int): this.type = super.setMaxIter(value)
    +
    +  override def setLearningRate(value: Double): this.type = 
super.setLearningRate(value)
    +
    +  // Parameters for GBTClassifier:
    +
    +  /**
    +   * Loss function which GBT tries to minimize. (case-insensitive)
    +   * Supported: "LogLoss"
    +   * (default = LogLoss)
    +   * @group param
    +   */
    +  val loss: Param[String] = new Param[String](this, "loss", "Loss function 
which GBT tries to" +
    --- End diff --
    
    `loss` -> `lossType`? `loss` may be too general. If `loss` appears in 
another algorithm, they should have similar semantic. For example, if we put 
`loss` as an evaluation metric, it becomes a numerical value. No strong 
preference.


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