How to change colors in decision tree plot using sklearn.tree.plot_tree into red and blue. red for class Diabetes and blue for class No Diabetes
# Separate the features (X) and target (y)
X = df_cleaned.drop('Outcome', axis=1)
y = df_cleaned['Outcome']
# Initialize the Decision Tree Classifier with max_depth=3 for simplification
dt_classifier = DecisionTreeClassifier(max_depth=3)
# Fit the model on the data
dt_classifier.fit(X, y)
# Plot the simplified decision tree
plt.figure(figsize=(15, 10))
plot_tree(dt_classifier, feature_names=X.columns.tolist(), class_names=['No Diabetes', 'Diabetes'], filled=True, rounded=True)
plt.title("Decision Tree for Diabetes Prediction")
plt.tight_layout()
plt.show()
red for class Diabetes and blue for class No Diabetes