parameters: (w)
return_statement: return i
docstring: calculate mutual information I(W)
      I(W) = sum over y e Y ( sum over x e X ( ... ) )
      .5 W(y|x) log frac { W(y|x) }{ .5 W(y|0) + .5 W(y|1) }
docstring_summary: calculate mutual information I(W)
      I(W) = sum over y e Y ( sum over x e X ( ... ) )
      .5 W(y|x) log frac { W(y|x) }{ .5 W(y|0) + .5 W(y|1) }
docstring_tokens: calculate mutual information I ( W ) I ( W ) = sum over y e Y ( sum over x e X ( ... ) ) . 5 W ( y|x ) log frac { W ( y|x ) } { . 5 W ( y|0 ) + . 5 W ( y|1 ) }
function: def mutual_information(w):
      '''
      calculate mutual information I(W)
      I(W) = sum over y e Y ( sum over x e X ( ... ) )
      .5 W(y|x) log frac { W(y|x) }{ .5 W(y|0) + .5 W(y|1) }
      '''
      ydim, xdim = np.shape(w)
      i = 0.0
      for y in range(ydim):
          for x in range(xdim):
              v = w[y][x] * np.log2(w[y][x] / (0.5 * w[y][0] + 0.5 * w[y][1]))
              i += v
      i /= 2.0
      return i
function_tokens: def mutual_information ( w ) : ydim , xdim = np . shape ( w ) i = 0.0 for y in range ( ydim ) : for x in range ( xdim ) : v = w [ y ] [ x ] * np . log2 ( w [ y ] [ x ] / ( 0.5 * w [ y ] [ 0 ] + 0.5 * w [ y ] [ 1 ] ) ) i += v i /= 2.0 return i