code: def energy(self, x, y):
          r
          pooler = self
          W      = pooler.connections.visible_to_hidden
          H      = pooler.connections.hidden_to_hidden
          b      = pooler.connections.hidden_bias
          n, m   = pooler.output_size, pooler.input_size
          w      = pooler.code_weight
  
          size_penalty = 0 if dot(y,y) <= w else np.inf
          energy       = - dot( y , exp( - b - dot(H, y) )  *  dot(W, x) ) 
  
          return energy + size_penalty
docs: r"""
          Numenta's energy with an additional term (the H-term) 
          to decorrelate pairwise column activity:
          $$ 
              E(x,y)  = - \sum_i y_i \cdot \exp( - b_i - \sum_j H_{ij} \ y_j ) \cdot (\sum_j W_{ij} \ x_j ) + S(y)
          $$
          where the size size penalty is given by
          $$ 
              S(y) = \begin{cases}
                      0        &  \text{if $\|y\| \leq w$, and} \\
                      +\infty  &  \text{otherwise,}
                     \end{cases}
          $$