-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-29116][PYTHON][ML] Refactor py classes related to DecisionTree #25929
Conversation
Test build #111364 has finished for PR 25929 at commit
|
Test build #111440 has finished for PR 25929 at commit
|
Test build #111756 has finished for PR 25929 at commit
|
Test build #111759 has finished for PR 25929 at commit
|
retest this please |
Test build #111863 has finished for PR 25929 at commit
|
python/pyspark/ml/regression.py
Outdated
@@ -1252,9 +999,29 @@ def featureImportances(self): | |||
return self._call_java("featureImportances") | |||
|
|||
|
|||
class GBTRegressorParams(GBTParams, TreeRegressorParams): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about rename it _GBT...
? like above _RandomForestClassifierParams
python/pyspark/ml/tree.py
Outdated
return self._call_java("toString") | ||
|
||
|
||
class DecisionTreeParams(HasCheckpointInterval, HasSeed, HasWeightCol): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
python/pyspark/ml/tree.py
Outdated
|
||
|
||
@inherit_doc | ||
class DecisionTreeModel(JavaPredictionModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
python/pyspark/ml/tree.py
Outdated
|
||
|
||
@inherit_doc | ||
class TreeEnsembleModel(JavaPredictionModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
python/pyspark/ml/tree.py
Outdated
return self._call_java("toString") | ||
|
||
|
||
class TreeEnsembleParams(DecisionTreeParams): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
python/pyspark/ml/tree.py
Outdated
return self.getOrDefault(self.featureSubsetStrategy) | ||
|
||
|
||
class RandomForestParams(TreeEnsembleParams): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
python/pyspark/ml/tree.py
Outdated
return self.getOrDefault(self.impurity) | ||
|
||
|
||
class TreeClassifierParams(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
python/pyspark/ml/tree.py
Outdated
return self.getOrDefault(self.impurity) | ||
|
||
|
||
class TreeRegressorParams(HasVarianceImpurity): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
@zhengruifeng |
@huaxingao Yes, I can reproduce your case. |
OK. I will add _single_leading_underscore to the classes you mentioned in the comments. Thanks! |
retest this please |
1 similar comment
retest this please |
Test build #111947 has finished for PR 25929 at commit
|
Merged to master, thanks @huaxingao |
Thanks a lot for your help! @zhengruifeng |
What changes were proposed in this pull request?
tree.py
predictLeaf
inDecisionTreeModel
&TreeEnsembleModel
Why are the changes needed?
Does this PR introduce any user-facing change?
Yes
add method
predictLeaf
inDecisionTreeModel
&TreeEnsembleModel
add
setMinWeightFractionPerNode
inDecisionTreeClassifier
andDecisionTreeRegressor
How was this patch tested?
add some doc tests