feature(nb): add a variance difference plot for digit 3 vs 8
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@@ -47,3 +47,12 @@ for i, ax in enumerate(axes.flat):
|
||||
ax.axis('off')
|
||||
fig.suptitle('NB: Pixel variance per class')
|
||||
fig.savefig('naivebayes_digits_variance.png', dpi=150, bbox_inches='tight')
|
||||
|
||||
# plot the variance difference between two commonly confused digits like 3 and 8 to see
|
||||
# on which pixels nb relies to tell them apart
|
||||
plt.figure()
|
||||
diff = abs(classifier.var_[3] - classifier.var_[8])
|
||||
plt.imshow(diff.reshape(8, 8), cmap='hot')
|
||||
plt.title('Variance difference: 3 vs 8')
|
||||
plt.colorbar()
|
||||
plt.savefig('naivebayes_3v8_variance.png', dpi=150, bbox_inches='tight')
|
||||
|
||||
Reference in New Issue
Block a user