neupy.plots.hinton module

neupy.plots.hinton.hinton(matrix, max_weight=None, ax=None, add_legend=True)[source]

Draw Hinton diagram for visualizing a weight matrix.

Parameters:
matrix: array-like

Matrix that you want to visualize using Hinton diagram.

max_weight : float

Maximum value of the matrix. If it’s equal to None than value would be calculated using the maximum from the matrix. Defaults to None.

ax : object

Matplotlib Axes instance. If value equal to None then function generate the new Axes instance. Defaults to None.

Returns:
object

Matplotlib Axes instance.

References

[1] http://matplotlib.org/examples/specialty_plots/hinton_demo.html

Examples

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from neupy import plots
>>>
>>> weight = np.random.randn(20, 20)
>>>
>>> plt.style.use('ggplot')
>>> plt.title("Hinton diagram")
>>> plt.figure(figsize=(16, 12))
>>>
>>> plots.hinton(weight)
>>> plt.show()