class_docstr: Stores information about the prediction of a `Policy`.
docstr: Creates a `PolicyPrediction`.
  
  Args:
      probabilities: The probabilities for each action.
      policy_name: Name of the policy which made the prediction.
      policy_priority: The priority of the policy which made the prediction.
      events: Events which the `Policy` needs to have applied to the tracker
          after the prediction. These events are applied independent of whether
          the policy wins against other policies or not. Be careful which events
          you return as they can potentially influence the conversation flow.
      optional_events: Events which the `Policy` needs to have applied to the
          tracker after the prediction in case it wins. These events are only
          applied in case the policy's prediction wins. Be careful which events
          you return as they can potentially influence the conversation flow.
      is_end_to_end_prediction: `True` if the prediction used the text of the
          user message instead of the intent.
      is_no_user_prediction: `True` if the prediction uses neither the text
          of the user message nor the intent. This is for the example the case
          for happy loop paths.
      diagnostic_data: Intermediate results or other information that is not
          necessary for Rasa to function, but intended for debugging and
          fine-tuning purposes.
      hide_rule_turn: `True` if the prediction was made by the rules which
          do not appear in the stories
      action_metadata: Specifies additional metadata that can be passed
          by policies.
docstr_tok: ["Creates","a","`","PolicyPrediction","`",".","Args",":","probabilities",":","The","probabilities","for","each","action",".","policy_name",":","Name","of","the","policy","which","made","the","prediction",".","policy_priority",":","The","priority","of","the","policy","which","made","the","prediction",".","events",":","Events","which","the","`","Policy","`","needs","to","have","applied","to","the","tracker","after","the","prediction",".","These","events","are","applied","independent","of","whether","the","policy","wins","against","other","policies","or","not",".","Be","careful","which","events","you","return","as","they","can","potentially","influence","the","conversation","flow",".","optional_events",":","Events","which","the","`","Policy","`","needs","to","have","applied","to","the","tracker","after","the","prediction","in","case","it","wins",".","These","events","are","only","applied","in","case","the","policy","'s","prediction","wins",".","Be","careful","which","events","you","return","as","they","can","potentially","influence","the","conversation","flow",".","is_end_to_end_prediction",":","`","True","`","if","the","prediction","used","the","text","of","the","user","message","instead","of","the","intent",".","is_no_user_prediction",":","`","True","`","if","the","prediction","uses","neither","the","text","of","the","user","message","nor","the","intent",".","This","is","for","the","example","the","case","for","happy","loop","paths",".","diagnostic_data",":","Intermediate","results","or","other","information","that","is","not","necessary","for","Rasa","to","function",",","but","intended","for","debugging","and","fine-tuning","purposes",".","hide_rule_turn",":","`","True","`","if","the","prediction","was","made","by","the","rules","which","do","not","appear","in","the","stories","action_metadata",":","Specifies","additional","metadata","that","can","be","passed","by","policies","."]
code: def __init__(
      self,
      probabilities: List[float],
      policy_name: Optional[Text],
      policy_priority: int = 1,
      events: Optional[List[Event]] = None,
      optional_events: Optional[List[Event]] = None,
      is_end_to_end_prediction: bool = False,
      is_no_user_prediction: bool = False,
      diagnostic_data: Optional[Dict[Text, Any]] = None,
      hide_rule_turn: bool = False,
      action_metadata: Optional[Dict[Text, Any]] = None,
  ) -> None:
      """Creates a `PolicyPrediction`.
  
      Args:
          probabilities: The probabilities for each action.
          policy_name: Name of the policy which made the prediction.
          policy_priority: The priority of the policy which made the prediction.
          events: Events which the `Policy` needs to have applied to the tracker
              after the prediction. These events are applied independent of whether
              the policy wins against other policies or not. Be careful which events
              you return as they can potentially influence the conversation flow.
          optional_events: Events which the `Policy` needs to have applied to the
              tracker after the prediction in case it wins. These events are only
              applied in case the policy's prediction wins. Be careful which events
              you return as they can potentially influence the conversation flow.
          is_end_to_end_prediction: `True` if the prediction used the text of the
              user message instead of the intent.
          is_no_user_prediction: `True` if the prediction uses neither the text
              of the user message nor the intent. This is for the example the case
              for happy loop paths.
          diagnostic_data: Intermediate results or other information that is not
              necessary for Rasa to function, but intended for debugging and
              fine-tuning purposes.
          hide_rule_turn: `True` if the prediction was made by the rules which
              do not appear in the stories
          action_metadata: Specifies additional metadata that can be passed
              by policies.
      """
      self.probabilities = probabilities
      self.policy_name = policy_name
      self.policy_priority = policy_priority
      self.events = events or []
      self.optional_events = optional_events or []
      self.is_end_to_end_prediction = is_end_to_end_prediction
      self.is_no_user_prediction = is_no_user_prediction
      self.diagnostic_data = diagnostic_data or {}
      self.hide_rule_turn = hide_rule_turn
      self.action_metadata = action_metadata
  
imports: from __future__ import annotations
  import abc
  import copy
  import logging
  from enum import Enum
  from pathlib import Path
  from rasa.shared.core.events import Event
  from typing import Any, List, Optional, Text, Dict, Callable, Tuple, TypeVar, TYPE_CHECKING
  import numpy
  from rasa.engine.graph import GraphComponent, ExecutionContext
  from rasa.engine.storage.resource import Resource
  from rasa.engine.storage.storage import ModelStorage
  from rasa.core.featurizers.precomputation import MessageContainerForCoreFeaturization
  from rasa.core.featurizers.tracker_featurizers import TrackerFeaturizer
  from rasa.core.featurizers.tracker_featurizers import MaxHistoryTrackerFeaturizer
  from rasa.core.featurizers.single_state_featurizer import SingleStateFeaturizer
  from rasa.core.featurizers.tracker_featurizers import FEATURIZER_FILE
  import rasa.utils.common
  import rasa.shared.utils.io
  from rasa.shared.exceptions import RasaException, FileIOException
  from rasa.shared.nlu.constants import ENTITIES, INTENT, TEXT, ACTION_TEXT, ACTION_NAME
  from rasa.shared.core.domain import Domain, State
  from rasa.shared.core.trackers import DialogueStateTracker
  from rasa.shared.core.generator import TrackerWithCachedStates
  from rasa.core.constants import DEFAULT_POLICY_PRIORITY, POLICY_PRIORITY, POLICY_MAX_HISTORY
  from rasa.shared.core.constants import USER, SLOTS, PREVIOUS_ACTION, ACTIVE_LOOP
  import rasa.shared.utils.common
label_desc: Use image node_id 1 to create a new PolicyPrediction object  with example: obj = PolicyPrediction(probabilities, policy_name, policy_priority, events, optional_events, is_end_to_end_prediction, is_no_user_prediction, diagnostic_data, hide_rule_turn, action_metadata)