class_docstr: `UnexpecTEDIntentPolicy` has the same model architecture as `TEDPolicy`.
  
  The difference is at a task level.
  Instead of predicting the next probable action, this policy
  predicts whether the last predicted intent is a likely intent
  according to the training stories and conversation context.
class_docstr_tok: ["`","UnexpecTEDIntentPolicy","`","has","the","same","model","architecture","as","`","TEDPolicy","`",".","The","difference","is","at","a","task","level",".","Instead","of","predicting","the","next","probable","action",",","this","policy","predicts","whether","the","last","predicted","intent","is","a","likely","intent","according","to","the","training","stories","and","conversation","context","."]
docstr: Predicts the next action the bot should take after seeing the tracker.
  
  Args:
      tracker: Tracker containing past conversation events.
      domain: Domain of the assistant.
      rule_only_data: Slots and loops which are specific to rules and hence
          should be ignored by this policy.
      precomputations: Contains precomputed features and attributes.
  
  Returns:
       The policy's prediction (e.g. the probabilities for the actions).
docstr_tok: ["Predicts","the","next","action","the","bot","should","take","after","seeing","the","tracker",".","Args",":","tracker",":","Tracker","containing","past","conversation","events",".","domain",":","Domain","of","the","assistant",".","rule_only_data",":","Slots","and","loops","which","are","specific","to","rules","and","hence","should","be","ignored","by","this","policy",".","precomputations",":","Contains","precomputed","features","and","attributes",".","Returns",":","The","policy","'s","prediction","(","e.g",".","the","probabilities","for","the","actions",")","."]
code: def predict_action_probabilities(
      self,
      tracker: DialogueStateTracker,
      domain: Domain,
      rule_only_data: Optional[Dict[Text, Any]] = None,
      precomputations: Optional[
          MessageContainerForCoreFeaturization
      ] = None,
      **kwargs: Any,
  ) -> PolicyPrediction:
      """Predicts the next action the bot should take after seeing the tracker.
  
      Args:
          tracker: Tracker containing past conversation events.
          domain: Domain of the assistant.
          rule_only_data: Slots and loops which are specific to rules and hence
              should be ignored by this policy.
          precomputations: Contains precomputed features and attributes.
  
      Returns:
           The policy's prediction (e.g. the probabilities for the actions).
      """
      if self.model is None:
          return self._prediction(self._default_predictions(domain))
  
      # Prediction through the policy is skipped if:
      # 1. If the tracker does not contain any event of type `UserUttered`
      #    till now or the intent of such event is not in domain.
      # 2. There is at least one event of type `ActionExecuted`
      #    after the last `UserUttered` event.
      if self._should_skip_prediction(tracker, domain):
          logger.debug(
              f"Skipping predictions for {self.__class__.__name__} "
              f"as either there is no event of type `UserUttered`, "
              f"event's intent is new and not in domain or "
              f"there is an event of type `ActionExecuted` after "
              f"the last `UserUttered`."
          )
          return self._prediction(self._default_predictions(domain))
  
      # create model data from tracker
      tracker_state_features = self._featurize_for_prediction(
          tracker,
          domain,
          precomputations,
          rule_only_data=rule_only_data,
      )
  
      model_data = self._create_model_data(tracker_state_features)
      output = self.model.run_inference(model_data)
  
      # take the last prediction in the sequence
      if isinstance(output["similarities"], np.ndarray):
          sequence_similarities = output["similarities"][:, -1, :]
      else:
          raise TypeError(
              "model output for `similarities` "
              "should be a numpy array"
          )
  
      # Check for unlikely intent
      last_user_uttered_event = tracker.get_last_event_for(UserUttered)
      query_intent = (
          last_user_uttered_event.intent_name
          if last_user_uttered_event is not None
          else ""
      )
      is_unlikely_intent = self._check_unlikely_intent(
          domain, sequence_similarities, query_intent
      )
  
      confidences = list(np.zeros(domain.num_actions))
  
      if is_unlikely_intent:
          confidences[
              domain.index_for_action(ACTION_UNLIKELY_INTENT_NAME)
          ] = 1.0
  
      return self._prediction(
          confidences,
          action_metadata=dataclasses.asdict(
              self._collect_action_metadata(
                  domain, sequence_similarities, query_intent
              )
          ),
      )
  
imports: import dataclasses
  import logging
  from pathlib import Path
  from typing import Any, List, Optional, Text, Dict, Type, Union
  import numpy
  import tensorflow
  import rasa.utils.common
  from rasa.engine.graph import ExecutionContext
  from rasa.engine.recipes.default_recipe import DefaultV1Recipe
  from rasa.engine.storage.resource import Resource
  from rasa.engine.storage.storage import ModelStorage
  from rasa.nlu.classifiers import LABEL_RANKING_LENGTH
  from rasa.shared.nlu.training_data.features import Features
  from rasa.shared.core.domain import Domain
  from rasa.shared.core.trackers import DialogueStateTracker
  from rasa.shared.core.constants import SLOTS, ACTIVE_LOOP, ACTION_UNLIKELY_INTENT_NAME
  from rasa.shared.core.events import UserUttered, ActionExecuted
  from rasa.shared.nlu.constants import INTENT, TEXT, ENTITIES, ACTION_NAME, SPLIT_ENTITIES_BY_COMMA, SPLIT_ENTITIES_BY_COMMA_DEFAULT_VALUE
  from rasa.nlu.extractors.extractor import EntityTagSpec
  from rasa.core.featurizers.precomputation import MessageContainerForCoreFeaturization
  from rasa.core.featurizers.tracker_featurizers import TrackerFeaturizer
  from rasa.core.featurizers.tracker_featurizers import IntentMaxHistoryTrackerFeaturizer
  from rasa.core.featurizers.single_state_featurizer import IntentTokenizerSingleStateFeaturizer
  from rasa.shared.core.generator import TrackerWithCachedStates
  from rasa.core.constants import DIALOGUE, POLICY_MAX_HISTORY, POLICY_PRIORITY, UNLIKELY_INTENT_POLICY_PRIORITY
  from rasa.core.policies.policy import PolicyPrediction
  from rasa.core.policies.ted_policy import LABEL_KEY, LABEL_SUB_KEY, TEDPolicy, TED, SEQUENCE_LENGTH, SEQUENCE, PREDICTION_FEATURES
  from rasa.utils import train_utils
  from rasa.utils.tensorflow.models import RasaModel
  from rasa.utils.tensorflow.constants import LABEL, DENSE_DIMENSION, ENCODING_DIMENSION, UNIDIRECTIONAL_ENCODER, TRANSFORMER_SIZE, NUM_TRANSFORMER_LAYERS, NUM_HEADS, BATCH_SIZES, BATCH_STRATEGY, EPOCHS, RANDOM_SEED, RANKING_LENGTH, LOSS_TYPE, SIMILARITY_TYPE, NUM_NEG, EVAL_NUM_EXAMPLES, EVAL_NUM_EPOCHS, REGULARIZATION_CONSTANT, SCALE_LOSS, EMBEDDING_DIMENSION, DROP_RATE_DIALOGUE, DROP_RATE_LABEL, DROP_RATE, DROP_RATE_ATTENTION, CONNECTION_DENSITY, KEY_RELATIVE_ATTENTION, VALUE_RELATIVE_ATTENTION, MAX_RELATIVE_POSITION, INNER, BALANCED, TENSORBOARD_LOG_DIR, TENSORBOARD_LOG_LEVEL, CHECKPOINT_MODEL, FEATURIZERS, ENTITY_RECOGNITION, IGNORE_INTENTS_LIST, BILOU_FLAG, LEARNING_RATE, CROSS_ENTROPY, SPARSE_INPUT_DROPOUT, DENSE_INPUT_DROPOUT, MASKED_LM, HIDDEN_LAYERS_SIZES, CONCAT_DIMENSION, TOLERANCE, LABEL_PAD_ID, POSITIVE_SCORES_KEY, NEGATIVE_SCORES_KEY, USE_GPU
  from rasa.utils.tensorflow import layers
  from rasa.utils.tensorflow.model_data import RasaModelData, FeatureArray, Data
  import rasa.utils.io
  from rasa.core.exceptions import RasaCoreException
  from rasa.shared.utils import common
label_desc: Use image node_id 13 for calling the UnexpecTEDIntentPolicy obj's underlying member method code with example usage: obj.predict_action_probabilities(tracker, domain, rule_only_data, precomputations) and returns: self, self, self