code: def max_entropy(active_learner, X, K=16, N=16):
      class_prob = active_learner.predict_proba(X)
      entropy = entr(class_prob).sum(axis=1)
      uncertain_idx = np.argpartition(entropy, -K)[-K:]
  
      """
      Original Implementation -- Pick most confident samples with
      entropy less than a threshold. Threshold is decayed in every
      iteration.
  
      Different than original -- Pick top n most confident samples.
      """
  
      confidence_idx = np.argpartition(entropy, N)[:N]
  
      return np.concatenate((uncertain_idx, confidence_idx), axis=0)
  
imports: from keras.datasets import mnist
  import numpy
  from modAL.models import ActiveLearner
  from sklearn.ensemble import RandomForestClassifier
  from scipy.special import entr
label_desc: Use image node_id 2 for calling a global function with example usage: max_entropy(active_learner, X, K, N) and returns: np