''DecisionTreeClassificationModel' object has no attribute 'stages'

tree = dtModel.stages[-1]
print(tree) #visualize the decision tree model

AttributeError Traceback (most recent call last) AttributeError: 'DecisionTreeClassificationModel' object has no attribute 'stages'

enter image description here

Please click the picture link to see more details. Thanks



Solution 1:[1]

Stages are used for pipeline models, if you fit your model using pipeline you can call model.stages.

Here is one example.

For normal decision tree models you should just call model.toDebugString

Hope this answers your question.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ahembal