code: def calculate_entropy(y):
      """Calculate the entropy of label array y"""
      log2 = lambda x: math.log(x) / math.log(2)
      unique_labels = np.unique(y)
      entropy = 0
      for label in unique_labels:
          count = len(y[y == label])
          p = count / len(y)
          entropy += -p * log2(p)
      return entropy
  
file_path: ML-From-Scratch/mlfromscratch/utils/data_operation.py
imports: from __future__ import division
  import numpy
  import math
  import sys
label_desc: Use image node_id 1 for calling a global function with example usage: calculate_entropy(y) and returns: entropy