Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/8609#discussion_r41446515
--- Diff: mllib/src/main/scala/org/apache/spark/ml/tree/Node.scala ---
@@ -279,6 +279,38 @@ private[tree] class LearningNode(
}
}
+ /**
+ * Get the node corresponding to this data point.
+ * This function mimics prediction, passing an example from the root
node down to a leaf
+ * or unsplit node; that node is returned.
+ *
+ * @param binnedFeatures Binned feature vector for data point.
+ * @param splits possible splits for all features, indexed
(numFeatures)(numSplits)
+ */
+ def predictImpl(binnedFeatures: Array[Int], splits:
Array[Array[Split]]): LearningNode = {
+ if (this.isLeaf || this.split.isEmpty) {
+ this
+ } else {
+ val split = this.split.get
+ val featureIndex = split.featureIndex
+ val splitLeft = split.shouldGoLeft(binnedFeatures(featureIndex),
splits(featureIndex))
+ if (this.leftChild.isEmpty) {
+ // Not yet split. Return next layer of nodes to train
+ if (splitLeft) {
+ leftChild.get
--- End diff --
Huh...maybe it does work. Maybe this part of the code is no longer needed.
Still, can you please update as requested to be safe, and we can keep this in
mind for potentially simplifying this method later on?
---
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]