Jan-23-2018, 04:49 AM
Obviously, I am new to python. I am getting indentation and space error,





def plot_images(numImages, images, cls_true, cls_pred=None): assert len(images) == len(cls_true) == numImages # Create figure with 3x3 sub-plots. #fig, axes = plt.subplots(3, 3) remainder = numImages % 5 if remainder == 0: row = numImages / 5 else: row = remainder fig, axes = plt.subplots(row, 5) fig.subplots_adjust(hspace=0.3, wspace=0.3) for i, ax in enumerate(axes.flat): # Plot image. ax.imshow(images[i].reshape(img_shape), cmap='binary') # Show true and predicted classes. if cls_pred is None: xlabel = "True: {0}".format(cls_true[i]) else: xlabel = "True: {0}, Pred: {1}".format(cls_true[i], cls_pred[i]) ax.set_xlabel(xlabel) # Remove ticks from the plot. ax.set_xticks([]) ax.set_yticks([]) # Ensure the plot is shown correctly with multiple plots # in a single Notebook cell. plt.show()Please help. thanks