Github user rotationsymmetry commented on a diff in the pull request:
https://github.com/apache/spark/pull/9008#discussion_r41591990
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/tree/impl/RandomForest.scala ---
@@ -1211,4 +1212,34 @@ private[ml] object RandomForest extends Logging {
}
}
+ /**
+ * Inject the sample weight to sub-sample weights of the baggedPoints
+ */
+ private[impl] def reweightSubSampleWeights(
+ baggedTreePoints: RDD[BaggedPoint[TreePoint]]):
RDD[BaggedPoint[TreePoint]] = {
+ baggedTreePoints.map {bagged =>
+ val treePoint = bagged.datum
+ val adjustedSubSampleWeights = bagged.subsampleWeights.map(w => w *
treePoint.weight)
+ new BaggedPoint[TreePoint](treePoint, adjustedSubSampleWeights)
+ }
+ }
+
+ /**
+ * A thin adaptor to
[[org.apache.spark.mllib.tree.impl.DecisionTreeMetadata.buildMetadata]]
+ */
+ private[impl] def buildWeightedMetadata(
+ input: RDD[WeightedLabeledPoint],
+ strategy: OldStrategy,
+ numTrees: Int,
+ featureSubsetStrategy: String) = {
--- End diff --
Thank you very much for your comment.
1) I will add the return type in my next push.
2) yes, you are right, I don't want to change the mllib impl yet. I will
leave it as a TODO after we have a standard way to represent weighted label
point.
---
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]