code: def select_actions(self, next_states, q_st_plus_1):
      if isinstance(
          self.ap.algorithm.action_drop_method_parameters, KNNParameters
      ):
          familiarity = np.array(
              [
                  [
                      distance[0]
                      for distance in knn_tree._get_k_nearest_neighbors_indices(
                          self.embedding(next_states), 1
                      )[
                          0
                      ]
                  ]
                  for knn_tree in self.knn_trees
              ]
          ).transpose()
          actions_to_mask_out = (
              familiarity
              > self.ap.algorithm.action_drop_method_parameters.average_dist_coefficient
              * self.average_dist
          )
  
      elif isinstance(
          self.ap.algorithm.action_drop_method_parameters,
          NNImitationModelParameters,
      ):
          familiarity = self.networks[
              "imitation_model"
          ].online_network.predict(next_states)
          actions_to_mask_out = (
              familiarity
              < self.ap.algorithm.action_drop_method_parameters.mask_out_actions_threshold
          )
      else:
          raise ValueError(
              "Unsupported action drop method {} for DDQNBCQAgent".format(
                  type(self.ap.algorithm.action_drop_method_parameters)
              )
          )
  
      masked_next_q_values = self.networks[
          "main"
      ].online_network.predict(next_states)
      masked_next_q_values[actions_to_mask_out] = -np.inf
  
      # occassionaly there are states in the batch for which our model shows no confidence for either of the actions
      # in that case, we will just randomly assign q_values to actions, since otherwise argmax will always return
      # the first action
      zero_confidence_rows = masked_next_q_values.max(axis=1) == -np.inf
      masked_next_q_values[zero_confidence_rows] = np.random.rand(
          np.sum(zero_confidence_rows), masked_next_q_values.shape[1]
      )
  
      return np.argmax(masked_next_q_values, 1)
  
imports: from collections import OrderedDict
  from copy import deepcopy
  from typing import Union, List, Dict
  import numpy
  from rl_coach.agents.dqn_agent import DQNAgentParameters, DQNAlgorithmParameters, DQNAgent
  from rl_coach.base_parameters import Parameters
  from rl_coach.core_types import EnvironmentSteps, Batch, StateType
  from rl_coach.graph_managers.batch_rl_graph_manager import BatchRLGraphManager
  from rl_coach.logger import screen
  from rl_coach.memories.non_episodic.differentiable_neural_dictionary import AnnoyDictionary
  from rl_coach.schedules import LinearSchedule
label_desc: Use image node_id 2 for calling the DDQNBCQAgent obj's underlying member method code with example usage: obj.select_actions(next_states, q_st_plus_1) and returns: np