Tag: Hyper Parameters In Decision Tree.


  • Hyper Parameters In Decision Tree.

    Hyper Parameters In Decision Tree Table Of Contents: Maximum Depth (max_depth) Minimum Samples Split (min_samples_split) Minimum Samples per Leaf (min_samples_leaf) Maximum Features (max_features) Maximum Leaf Nodes (max_leaf_nodes) Minimum Impurity Decrease (min_impurity_decrease) Split Criterion (criterion) Random State (random_state) Class Weight (class_weight) Presort (presort) Splitter (splitter) (1) Maximum Depth (max_depth) from sklearn.datasets import load_iris from sklearn.tree import DecisionTreeClassifier, export_text from sklearn.tree import plot_tree import matplotlib.pyplot as plt # Load the Iris dataset iris = load_iris() X, y = iris.data, iris.target # Build a decision tree with max_depth=3 clf = DecisionTreeClassifier(max_depth=3, random_state=42) clf.fit(X, y) # Plot the decision tree plt.figure(figsize=(12, 8)) plot_tree(clf, feature_names=iris.feature_names,

    Read More