I’m getting the following error when trying to run the code below
ValueError: Shape of passed values is (14, 14), indices imply (15, 15)
def plot_confusion_matrix(cm):
cm = cm[::-1]
cm = pd.DataFrame(cm, columns=classes, index=classes[::-1])
fig = ff.create_annotated_heatmap(z=cm.values, x=list(cm.columns), y=list(cm.index), colorscale='ice', showscale=True, reversescale=True)
fig.update_layout(width=500, height=500, title='Confusion Matrix', font_size=16)
fig.show()
import plotly.figure_factory as ff
plot_confusion_matrix(cm)
Does anyone know how this can be resolved?