来自Stats StackExchange的矩阵信息测量示例的Python实现,用于测量二维二进制矩阵的熵/信息/模式,最初由William Huber使用Mathematica编写并运行。以下是通过运行程序python main.py的输出:

--- Matrix #0 ---

Neighborhood size = 1

[[ 0. 1. 0.]

[ 1. 0. 1.]

[ 1. 0. 0.]

[ 0. 1.]

[ 1. 0. 0.]]

Neighborhood size = 2

[[ 0.75]

[ 0.75 0.5 ]

[ 0.5 0.75 0.5 ]]