Decision Tree in Python
Train Decision Tree in Python. Algorithm can be used in classification and regression tasks. Please make sure that there are no missing values in the training data and all values are numeric.
Please check Advanced options. There are several criterions available to measure split quality. What is more, you can control the tree structure by selecting minimum number of samples for internal node split and minimum samples in the leaf. The max depth parameter controls the depth of the tree, if it is not set then tree is trained till all leaves are pure or there are minimum samples in the internal node.
Decision Tree model can be persisted to hard disk in pickle format.
Required packages
You need below packages to use the code generated by recipe. All packages are automatically installed in MLJAR Studio.
scikit-learn>=1.5.0
Interactive recipe
You can use below interactive recipe to generate code. This recipe is available in MLJAR Studio.
Python code
# Python code will be here
Code explanation
This code recipe initialize Decision Tree object. It is ready to fit or tunning.
Fitted object can be used to compute predictions. If you want to persist your Decision Tree, please save it to pickle file (Save to pickle recipe).
Example Python notebooks
Please find inspiration in example notebooks
Scikit-learn cookbook
Code recipes from Scikit-learn cookbook.
- « Previous
- Scikit-learn
- Next »
- Random Forest