After using X.test.values.reshape, I still cannot get images ig, axes = plt.subplots(10, 10, figsize=(8, 8), subplot_kw={‘xticks’:[], ‘yticks’:[]}, gridspec_kw=dict(hspace=0.1, wspace=0.1)) test_images = Xtest.reshape(-1,8,8) for i, ax in enumerate(axes.flat): ax.imshow(test_images[i], cmap=’binary’, interpolation=’nearest’) ax.text(0.05, 0.05, str(y_model[i]), transform=ax.transAxes, color=’green’ if (ytest[i] == y_model[i]) else ‘red’) Source: Python..

Read more

I have the following multiindex from a df.groupby(level=1).max(). How to split the index (box_c_r) into two c and r and then plot a heatmap of (val, c, r). (1) I need to convert this: val name box_0_0 0.316349 box_0_1 0.788936 box_0_2 1.035940 box_0_3 0.340709 box_1_0 0.326872 box_1_1 1.967770 box_1_2 1.720290 box_1_3 0.329771 box_2_0 0.194211 box_2_1 ..

Read more