# Feature Importance using decision tree

**URL:** <https://forum.knime.com/t/feature-importance-using-decision-tree/27711>\
**Category:** KNIME Analytics Platform\
**Created:** [September 30, 2020, 6:19am UTC](https://forum.knime.com/t/feature-importance-using-decision-tree/27711 "2020-09-30T06:19:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sschacht](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/e480ec/32.png) [@sschacht](https://forum.knime.com/u/sschacht)\
**Post date:** [September 30, 2020, 6:19am UTC](https://forum.knime.com/t/feature-importance-using-decision-tree/27711/1 "2020-09-30T06:19:57Z")

</div>

Hi Everybody,

I have a question is it possible to extract feature importance in Knime using decision tree learner and predictor?

Using sklearn I usual use the following code for it:

from sklearn.tree import DecisionTreeClassifier  
dt = DecisionTreeClassifier()  
dt.fit(X\_train, y\_train)  
dt.score(X\_test, y\_test)

dt.feature\_importances\_

For sure I could use the python node, but I try to transfer my normal tasks to KNIME without using python.  
Does somebody have an idea?

---

<div class="post-metadata">

**Author:** ![ipazin](https://forum-cdn.knime.com/user_avatar/forum.knime.com/ipazin/32/806_2.png) [@ipazin](https://forum.knime.com/u/ipazin)\
**Post date:** [September 30, 2020, 12:05pm UTC](https://forum.knime.com/t/feature-importance-using-decision-tree/27711/2 "2020-09-30T12:05:31Z")

</div>

Hello @sschacht,

see these two topics:

> [@Decision tree prediction - Individual driving factors](https://forum.knime.com/t/decision-tree-prediction-individual-driving-factors/18358):
>
> Dear community, I was applying a Decision Tree model (learner and predictor) to perform a turnover prediction for employees in a company. After looking at the outputs including a probability for an individual to leave/stay we were asking ourselves, if there is a possibility to identify the “driving factors” per individual case. By generating this information, we would then be able to better understand which actions could be taken (based on an individual level) to mitigate certain probabilities. …

> [@Feature Importance in Decision Trees](https://forum.knime.com/t/feature-importance-in-decision-trees/21752):
>
> Feature importance is difficult to discern from all of KNIME’s tree nodes. For global feature importance, Random Forest and Tree Ensemble provide split information for 3 levels - but if trees are deeper that split information is lost (a frustration already expressed by @aconca at [Tree Ensemble Learner - variable importance?](https://forum.knime.com/t/tree-ensemble-learner-variable-importance/3680)). For H2O GBT, feature importance is provided as a single score. But the KNIME GBT nodes provide no indicators of feature importance. There is also no means to extract the tr…

Br,  
Ivan

---

<div class="post-metadata">

**Author:** ![HansS](https://forum-cdn.knime.com/user_avatar/forum.knime.com/hanss/32/6979_2.png) [@HansS](https://forum.knime.com/u/HansS)\
**Post date:** [September 30, 2020, 12:22pm UTC](https://forum.knime.com/t/feature-importance-using-decision-tree/27711/3 "2020-09-30T12:22:19Z")

</div>

Hi @sschacht  
Maybe the [Information Gain Calculator](https://nodepit.com/node/ws.palladian.nodes.classification.featureselection.InformationGainCalculatorNodeFactory) helps you to give some insights about the feature importance.  
gr. Hans

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [April 1, 2021, 12:22am UTC](https://forum.knime.com/t/feature-importance-using-decision-tree/27711/4 "2021-04-01T00:22:37Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
