Learn.
In this section we will learn how to setup graph and compare model evaluation comparison (e.g. Linear Regression, Lasso, Ridge, Elastic Net etc.)
# Create a bar plot to compare the RMSE values of the different regression models.
# ‘x’ axis represents the model names, ‘y’ axis represents the RMSE values.
# ‘palette=’viridis” sets the color scheme for the bars.
ax = sns.barplot(x=model_names, y=rmse, palette=’viridis’)
# Set the title of the plot for clarity.
plt.title(“Comparison of models (RMSE)”)
# Add text annotations on top of each bar to display the exact RMSE value.
# ‘ax.containers’ iterates through the bar containers in the plot.
# ‘ax.bar_label(container, fmt=’%.2f’)’ adds a label to each bar, formatted to two decimal places.
for container in ax.containers:
ax.bar_label(container, fmt=’%.2f’)