# How max_features parameter works in DecisionTreeClassifier?

What is the parameter max_features in DecisionTreeClassifier responsible for?

I thought it defines the number of features the tree uses to generate its nodes. But in spite of the different values of this parameter (n = 1 and 2), my tree employs both features that I have. What changes so?

max_features = 2

max_features = 1

You can see x1 and x2 are used in both cases

• In the documentation it is stated: "If int, then consider max_features features at each split". Thus, it it is the maximum number of features used in the condition at each node of the tree. Your example is misleading, because even in the case of max_features=2 your splits are using only one feature in the decisions. Nov 19 '18 at 16:07
• Could you provide any example as an answer, please? Because I could find graphs with only one feature condition at each node. For example, check first ten graphs from google.com/… Nov 19 '18 at 16:37
• Possible duplicate of Is max_depth in scikit the equivalent of pruning in decision trees?
– MzdR
Nov 19 '18 at 21:02
• Hi James, it seems that my comment was also inaccurate. @Bashar Haddad's answer sounds more convincing to me. If it convinces you as well, I'd suggest you accept it. Nov 20 '18 at 8:44
• @MzdR, the two questions are about different parameters, thus not duplicate. Nov 20 '18 at 8:44