Github user yanboliang commented on a diff in the pull request:
https://github.com/apache/spark/pull/15913#discussion_r89591662
--- Diff: mllib/src/main/scala/org/apache/spark/ml/tree/treeParams.scala ---
@@ -317,8 +317,32 @@ private[ml] trait TreeEnsembleParams extends
DecisionTreeParams {
}
}
-/** Used for [[RandomForestParams]] */
-private[ml] trait HasFeatureSubsetStrategy extends Params {
+/**
+ * Parameters for Random Forest algorithms.
+ */
+private[ml] trait RandomForestParams extends TreeEnsembleParams {
+
+ /**
+ * Number of trees to train (>= 1).
+ * If 1, then no bootstrapping is used. If > 1, then bootstrapping is
done.
+ * TODO: Change to always do bootstrapping (simpler). SPARK-7130
+ * (default = 20)
+ *
+ * Note: The reason that we cannot add this to both GBT and RF (i.e. in
TreeEnsembleParams)
+ * is the param `maxIter` controls how many trees a GBT has. The
semantics in the algorithms
+ * are a bit different.
+ * @group param
+ */
+ final val numTrees: IntParam = new IntParam(this, "numTrees", "Number of
trees to train (>= 1)",
+ ParamValidators.gtEq(1))
+
+ setDefault(numTrees -> 20)
+
+ /** @group setParam */
+ def setNumTrees(value: Int): this.type = set(numTrees, value)
--- End diff --
Yeah, we already have ```setNumTrees``` which calls ```super.setNumTrees```
in ```RandomForestClassifier``` and ```RandomForestRegressor```.
---
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]