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

    https://github.com/apache/spark/pull/2394#discussion_r18106962
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/regression/StochasticGradientBoosting.scala
 ---
    @@ -0,0 +1,173 @@
    +package org.apache.spark.mllib.regression
    +
    +import org.apache.spark.mllib.linalg.Vector
    +import org.apache.spark.mllib.tree.DecisionTree
    +import org.apache.spark.mllib.tree.configuration.Algo.Algo
    +import org.apache.spark.mllib.tree.configuration.Strategy
    +import org.apache.spark.mllib.tree.impurity.Impurity
    +import org.apache.spark.mllib.tree.model.DecisionTreeModel
    +import org.apache.spark.rdd.{DoubleRDDFunctions, RDD}
    +import scala.util.Random
    +
    +/**
    + *
    + * Read about the algorithm "Gradient boosting" here:
    + * 
http://www.montefiore.ulg.ac.be/services/stochastic/pubs/2007/GWD07/geurts-icml2007.pdf
    + *
    + * Libraries that implement the algorithm "Gradient boosting" similar way
    + * https://code.google.com/p/jforests/
    + * https://code.google.com/p/jsgbm/
    + *
    + */
    +class StochasticGradientBoosting {
    +
    +  /**
    +   * Train a Gradient Boosting model given an RDD of (label, features) 
pairs.
    +   *
    +   * @param input Training dataset: RDD of 
[[org.apache.spark.mllib.regression.LabeledPoint]].
    +   * @param leaningRate Learning rate
    +   * @param countOfTrees Number of trees.
    +   * @param samplingSizeRatio Size of random sample, percent of ${input} 
size.
    +   * @param strategy The configuration parameters for the tree algorithm 
which specify the type
    +   *                 of algorithm (classification, regression, etc.), 
feature type (continuous,
    +   *                 categorical), depth of the tree, quantile calculation 
strategy, etc.
    +   * @return StochasticGradientBoostingModel that can be used for 
prediction
    +   */
    +  def run(
    +       input : RDD[LabeledPoint],
    +       leaningRate : Double,
    +       countOfTrees : Int,
    +       samplingSizeRatio : Double,
    +       strategy: Strategy): StochasticGradientBoostingModel = {
    +
    +    val featureDimension = input.count()
    --- End diff --
    
    This is not feature dimension, rather, input.count() is the number of 
LabeledPoint in your RDD. if you would like to compute feature dimension, 
please use
    input.take(1).features.length


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to