[ 
https://issues.apache.org/jira/browse/SPARK-26721?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Jumper updated SPARK-26721:
----------------------------------
    Description: 
The feature importance calculation in 
org.apache.spark.ml.classification.GBTClassificationModel.featureImportances 
follows a flawed implementation from scikit-learn. An error was recently 
discovered and updated in scikit-learn version 0.20.0. This error is inherited 
in the spark implementation and needs to be fixed here as well.

As described in the scikit-learn release notes 
([https://scikit-learn.org/stable/whats_new.html#version-0-20-0]):
{quote}Fix Fixed a bug in ensemble.GradientBoostingRegressor and 
ensemble.GradientBoostingClassifier to have feature importances summed and then 
normalized, rather than normalizing on a per-tree basis. The previous behavior 
over-weighted the Gini importance of features that appear in later stages. This 
issue only affected feature importances. #11176 by Gil Forsyth.
{quote}
Full discussion of this error and debate ultimately validating the correctness 
of the change can be found in the comment thread of the scikit-learn pull 
request: [https://github.com/scikit-learn/scikit-learn/pull/11176] 

 

I believe the main change required would be to the featureImportances function 
in mllib/src/main/scala/org/apache/spark/ml/tree/treeModels.scala , however, I 
do not have the experience to make this change myself.

  was:
The feature importance calculation in 
org.apache.spark.ml.classification.GBTClassificationModel.featureImportances 
follows a flawed implementation from scikit-learn. An error was recently 
discovered and updated in scikit-learn version 0.20.0. This error is inherited 
in the spark implementation and needs to be fixed here as well.

As described in the [scikit-learn release 
notes|[https://scikit-learn.org/stable/whats_new.html#version-0-20-0]|https://scikit-learn.org/stable/whats_new.html#version-0-20-0]:]
  :
{quote}
Fix Fixed a bug in ensemble.GradientBoostingRegressor and 
ensemble.GradientBoostingClassifier to have feature importances summed and then 
normalized, rather than normalizing on a per-tree basis. The previous behavior 
over-weighted the Gini importance of features that appear in later stages. This 
issue only affected feature importances. #11176 by Gil Forsyth.
{quote}
Full discussion of this error and debate ultimately validating the correctness 
of the change can be found in the comment thread of the scikit-learn pull 
request: [https://github.com/scikit-learn/scikit-learn/pull/11176] 

 

I believe the main change required would be to the featureImportances function 
in mllib/src/main/scala/org/apache/spark/ml/tree/treeModels.scala , however, I 
do not have the experience to make this change myself.


> Bug in feature importance calculation in GBM (and possibly other decision 
> tree classifiers)
> -------------------------------------------------------------------------------------------
>
>                 Key: SPARK-26721
>                 URL: https://issues.apache.org/jira/browse/SPARK-26721
>             Project: Spark
>          Issue Type: Bug
>          Components: ML
>    Affects Versions: 2.4.0
>            Reporter: Daniel Jumper
>            Priority: Critical
>
> The feature importance calculation in 
> org.apache.spark.ml.classification.GBTClassificationModel.featureImportances 
> follows a flawed implementation from scikit-learn. An error was recently 
> discovered and updated in scikit-learn version 0.20.0. This error is 
> inherited in the spark implementation and needs to be fixed here as well.
> As described in the scikit-learn release notes 
> ([https://scikit-learn.org/stable/whats_new.html#version-0-20-0]):
> {quote}Fix Fixed a bug in ensemble.GradientBoostingRegressor and 
> ensemble.GradientBoostingClassifier to have feature importances summed and 
> then normalized, rather than normalizing on a per-tree basis. The previous 
> behavior over-weighted the Gini importance of features that appear in later 
> stages. This issue only affected feature importances. #11176 by Gil Forsyth.
> {quote}
> Full discussion of this error and debate ultimately validating the 
> correctness of the change can be found in the comment thread of the 
> scikit-learn pull request: 
> [https://github.com/scikit-learn/scikit-learn/pull/11176] 
>  
> I believe the main change required would be to the featureImportances 
> function in mllib/src/main/scala/org/apache/spark/ml/tree/treeModels.scala , 
> however, I do not have the experience to make this change myself.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to