Is max_depth in scikit the equivalent of pruning in decision trees?
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I was analyzing the classifier created using a decision tree. There is a tuning parameter called max_depth in scikit's decision tree. Is this equivalent of pruning a decision tree? If not, how could I prune a decision tree using scikit?
dt_ap = tree.DecisionTreeClassifier(random_state=1, max_depth=13)
boosted_dt = AdaBoostClassifier(dt_ap, random_state=1)
boosted_dt.fit(X_train, Y_train)
machine-learning python scikit-learn decision-trees supervised-learning
add a comment |Â
up vote
2
down vote
favorite
I was analyzing the classifier created using a decision tree. There is a tuning parameter called max_depth in scikit's decision tree. Is this equivalent of pruning a decision tree? If not, how could I prune a decision tree using scikit?
dt_ap = tree.DecisionTreeClassifier(random_state=1, max_depth=13)
boosted_dt = AdaBoostClassifier(dt_ap, random_state=1)
boosted_dt.fit(X_train, Y_train)
machine-learning python scikit-learn decision-trees supervised-learning
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I was analyzing the classifier created using a decision tree. There is a tuning parameter called max_depth in scikit's decision tree. Is this equivalent of pruning a decision tree? If not, how could I prune a decision tree using scikit?
dt_ap = tree.DecisionTreeClassifier(random_state=1, max_depth=13)
boosted_dt = AdaBoostClassifier(dt_ap, random_state=1)
boosted_dt.fit(X_train, Y_train)
machine-learning python scikit-learn decision-trees supervised-learning
I was analyzing the classifier created using a decision tree. There is a tuning parameter called max_depth in scikit's decision tree. Is this equivalent of pruning a decision tree? If not, how could I prune a decision tree using scikit?
dt_ap = tree.DecisionTreeClassifier(random_state=1, max_depth=13)
boosted_dt = AdaBoostClassifier(dt_ap, random_state=1)
boosted_dt.fit(X_train, Y_train)
machine-learning python scikit-learn decision-trees supervised-learning
machine-learning python scikit-learn decision-trees supervised-learning
asked 5 hours ago


Suhail Gupta
1907
1907
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
Is this equivalent of pruning a decision tree?
Though they have similar goals (i.e. placing some restrictions to the model so that it doesn't grow very complex and overfit), max_depth
isn't equivalent to pruning. The way pruning usually works is that go back through the tree and replace branches that do not help with leaf nodes.
If not, how could I prune a decision tree using scikit?
You can't through scikit-learn (without altering the source code).
Quote taken from the Decision Tree documentation: Mechanisms such as pruning (not currently supported)
If you want to post-prune a tree you have to do it on your own:
You can read this excellent post detailing how to do so.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Is this equivalent of pruning a decision tree?
Though they have similar goals (i.e. placing some restrictions to the model so that it doesn't grow very complex and overfit), max_depth
isn't equivalent to pruning. The way pruning usually works is that go back through the tree and replace branches that do not help with leaf nodes.
If not, how could I prune a decision tree using scikit?
You can't through scikit-learn (without altering the source code).
Quote taken from the Decision Tree documentation: Mechanisms such as pruning (not currently supported)
If you want to post-prune a tree you have to do it on your own:
You can read this excellent post detailing how to do so.
add a comment |Â
up vote
2
down vote
Is this equivalent of pruning a decision tree?
Though they have similar goals (i.e. placing some restrictions to the model so that it doesn't grow very complex and overfit), max_depth
isn't equivalent to pruning. The way pruning usually works is that go back through the tree and replace branches that do not help with leaf nodes.
If not, how could I prune a decision tree using scikit?
You can't through scikit-learn (without altering the source code).
Quote taken from the Decision Tree documentation: Mechanisms such as pruning (not currently supported)
If you want to post-prune a tree you have to do it on your own:
You can read this excellent post detailing how to do so.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Is this equivalent of pruning a decision tree?
Though they have similar goals (i.e. placing some restrictions to the model so that it doesn't grow very complex and overfit), max_depth
isn't equivalent to pruning. The way pruning usually works is that go back through the tree and replace branches that do not help with leaf nodes.
If not, how could I prune a decision tree using scikit?
You can't through scikit-learn (without altering the source code).
Quote taken from the Decision Tree documentation: Mechanisms such as pruning (not currently supported)
If you want to post-prune a tree you have to do it on your own:
You can read this excellent post detailing how to do so.
Is this equivalent of pruning a decision tree?
Though they have similar goals (i.e. placing some restrictions to the model so that it doesn't grow very complex and overfit), max_depth
isn't equivalent to pruning. The way pruning usually works is that go back through the tree and replace branches that do not help with leaf nodes.
If not, how could I prune a decision tree using scikit?
You can't through scikit-learn (without altering the source code).
Quote taken from the Decision Tree documentation: Mechanisms such as pruning (not currently supported)
If you want to post-prune a tree you have to do it on your own:
You can read this excellent post detailing how to do so.
answered 51 mins ago
Djib2011
1,742516
1,742516
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f38666%2fis-max-depth-in-scikit-the-equivalent-of-pruning-in-decision-trees%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password