class_docstr: Implements "Batch Active learning by Diverse Gradient Embedding" (BADGE) [AZK+20]_.
      
class_docstr_tok: ["Implements","``","Batch","Active","learning","by","Diverse","Gradient","Embedding","''","(","BADGE",")","[","AZK+20","]","_","."]
code: def get_badge_embeddings(self, embeddings, proba):
      proba_argmax = np.argmax(proba, axis=1)
      scale = -1 * proba
      scale[proba_argmax] = -1 * proba[proba_argmax]
  
      if self.num_classes > 2:
          embedding_size = embeddings.shape[1]
          badge_embeddings = np.zeros(
              (embeddings.shape[0], embedding_size * self.num_classes)
          )
          for c in range(self.num_classes):
              badge_embeddings[
                  :, c * embedding_size : (c + 1) * embedding_size
              ] = (scale[:, c] * np.copy(embeddings).T).T
      else:
          badge_embeddings = embeddings
  
      return badge_embeddings
  
imports: import numpy
  from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
  from small_text.query_strategies import constraints, QueryStrategy, EmbeddingBasedQueryStrategy
  from small_text.utils.clustering import init_kmeans_plusplus_safe
  from small_text.utils.context import build_pbar_context
  from small_text.utils.data import list_length
label_desc: Use image node_id 3 for calling the BADGE obj's underlying member method code with example usage: obj.get_badge_embeddings(embeddings, proba) and returns: badge_embeddings