from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OrdinalEncoder
from sklearn.tree import DecisionTreeClassifier
from sklearn.datasets import load_iris
from sklearn.tree import plot_tree
from sklearn.metrics import classification_report

# Load the iris dataset
iris = load_iris()
# Define the transformer
ct = ColumnTransformer(
    [("encode", OrdinalEncoder(), [3])], remainder="passthrough"
# Transform the data
X = ct.fit_transform(

# Define and fit the decision tree
tree = DecisionTreeClassifier(),

# Visualize the tree
# Evaluate the tree on the training data
y_pred = tree.predict(X)
print(classification_report(, y_pred))