code: def compute_heatmap(weight):
      heatmap = np.zeros((GRID_HEIGHT, GRID_WIDTH))
      for (neuron_x, neuron_y), neighbours in iter_neighbours(weight):
          total_distance = 0
  
          for neigbour_x, neigbour_y in neighbours:
              neuron_vec = weight[:, neuron_x, neuron_y]
              neigbour_vec = weight[:, neigbour_x, neigbour_y]
  
              distance = np.linalg.norm(neuron_vec - neigbour_vec)
              total_distance += distance
  
          avg_distance = total_distance / len(neighbours)
          heatmap[neuron_x, neuron_y] = avg_distance
  
      return heatmap
  
file_path: neupy/examples/competitive/sofm_heatmap_visualization.py
imports: import argparse
  import numpy
  import matplotlib.pyplot
  from sklearn import datasets, preprocessing
  from neupy import algorithms, utils
  from utils import iter_neighbours
label_desc: Use image node_id 2 for calling a global function with example usage: compute_heatmap(weight) and returns: heatmap