def test_hinton_only_negative(self): original_image_name = format_image_name("hinton_only_negative.png") original_image = os.path.join(IMGDIR, original_image_name) with image_comparison(original_image, figsize=(10, 6)) as fig: weight = -np.random.random((20, 20)) ax = fig.add_subplot(1, 1, 1) plots.hinton(weight, ax=ax)
def test_hinton_1darray(self): original_image_name = format_image_name("hinton_1darray.png") original_image = os.path.join(IMGDIR, original_image_name) with image_comparison(original_image, figsize=(10, 4)) as fig: weight = -np.random.randn(20) ax = fig.add_subplot(1, 1, 1) plots.hinton(weight, ax=ax)
def test_max_weight(self): original_image_name = format_image_name("max_weight_hinton.png") original_image = os.path.join(IMGDIR, original_image_name) with image_comparison(original_image, figsize=(10, 6)) as fig: weight = 100 * np.random.randn(20, 20) ax = fig.add_subplot(1, 1, 1) plots.hinton(weight, ax=ax, max_weight=10, add_legend=True)
def test_hinton_without_legend(self): original_image_name = format_image_name("hinton_without_legend.png") original_image = os.path.join(IMGDIR, original_image_name) with image_comparison(original_image, figsize=(10, 6)) as fig: weight = np.random.randn(20, 20) ax = fig.add_subplot(1, 1, 1) plots.hinton(weight, ax=ax, add_legend=False)
def test_hinton_1darray(self): fig = plt.figure() ax = fig.add_subplot(1, 1, 1) weight = -np.random.randn(20) plots.hinton(weight, ax=ax) return fig
def test_hinton_without_legend(self): fig = plt.figure() ax = fig.add_subplot(1, 1, 1) weight = np.random.randn(20, 20) plots.hinton(weight, ax=ax, add_legend=False) return fig
def test_hinton_only_negative(self): fig = plt.figure() ax = fig.add_subplot(1, 1, 1) weight = -np.random.random((20, 20)) plots.hinton(weight, ax=ax) return fig
def test_max_weight(self): fig = plt.figure() ax = fig.add_subplot(1, 1, 1) weight = 100 * np.random.randn(20, 20) plots.hinton(weight, ax=ax, max_weight=10, add_legend=True) return fig
def test_simple_hinton(self): original_image_name = format_image_name("simple_hinton.png") original_image = os.path.join(IMGDIR, original_image_name) with image_comparison(original_image, figsize=(10, 6)) as fig: weight = np.random.randn(20, 20) ax = fig.add_subplot(1, 1, 1) plt.sca(ax) # To test the case when ax=None plots.hinton(weight, add_legend=True)
def test_simple_hinton(self): fig = plt.figure() ax = fig.add_subplot(1, 1, 1) plt.sca(ax) # To test the case when ax=None weight = np.random.randn(20, 20) plots.hinton(weight, add_legend=True) return fig