Belief Tracking¶
BeliefTrackingManager.py - wrapper for belief tracking across domains¶
Copyright CUED Dialogue Systems Group 2015 - 2017
See also
CUED Imports/Dependencies:
import utils.Settings
import ontology.OntologyUtils
import utils.ContextLogger
-
class
belieftracking.BeliefTrackingManager.
BeliefTrackingManager
¶ Higher-level belief tracker manager
-
_load_domains_belieftracker
(domainString=None)¶ Load domain’s belief tracker
Parameters: domainString (string) – domain name Returns: None
-
bootup
(domainString, previousDomainString=None)¶ Boot up the belief tracker
Parameters: - domainString (string) – domain name
- previousDomainString (string) – previous domain name
Returns: None
-
conditionally_init_new_domains_belief
(domainString, previousDomainString)¶ If just starting this domain in this dialog: Get count80 slot=value pairs from previous domains in order to initialise the belief state of the new domain (reflecting dialogs history and likelihood that similar values will be desired if there are slot overlaps.
Parameters: - domainString (string) – domain name
- previousDomainString (string) – previous domain name
Returns: None
-
restart
()¶ Restart every alive Belief Tracker
-
update_belief_state
(dstring, lastSysAct, inputActs, constraints)¶ Update belief state given infos
-
BeliefTracker.py - Belief Tracker¶
Copyright CUED Dialogue Systems Group 2015 - 2017
See also
CUED Imports/Dependencies:
import utils.dact
import utils.ContextLogger
import policy.SummaryUtils
import ontology.Ontology
import belieftracking.BeliefTrackingUtils
-
class
belieftracking.BeliefTracker.
BeliefTracker
(domainString)¶ Belief Tracker base class that implements most of the functionality within the dialogue system. The actual inference problem of belief tracking (ASR/SLU –> belief state update) is implemented by individual trackers (in baseline.py for example). Hence this class will never be instantiated, it just implements common functionality. If developing a new tracker - it should inherit this class and implement a self.tracker.
-
_conditionally_init_belief
(belief, constraints)¶ Method for conditionally setting up the inital belief state of a domain based on information/events that occured earlier in the dialogue in ANOTHER (ie different) domain.
Parameters: - belief (dict) – initial belief state
- constraints (dict) – a dict of constraints
Returns: None
-
_convertHypToTurn
(lastact, obs)¶ Convert hypotheses to turn
Parameters: - lastact (string) – last system dialgue act
- obs (list) – current observation
Returns: dict – turn dict
-
_init_belief
(constraints=None)¶ Simply constructs the belief state data structure at turn 0
Parameters: constraints (dict) – a dict of constraints Returns: dict – initiliased belief state
-
_print_belief
()¶ Just a Debug function
-
_updateBelief
(turn)¶ Update the belief given the current turn info
-
_updateMactFeat
(last_feature, lastact)¶ Add features into self.prevstate - recording actions taken by machine
Parameters: - last_feature (dict) – last system state features
- lastact (string) – last system dialgoue act
Returns: None
-
getBelief80_pairs
()¶ Called by EXITING DOMAIN
-
get_conditional_constraints
(prev_domain_constraints)¶ Called by ENTERING DOMAIN Takes a dict (keys=all available domains we have – more info this way than just a list of slots + values) of constraints from previous domains AS DETERMINED BY THE DIALOGS IN THOSE DOMAINS WITH THE DOMAINS OWN TRACKER - then conditionally initialises the new tracker. (Meaning this is only called when domain is first launched within a single dialog).
Parameters: prev_domain_constraints (dict) – a dict of constraints from previous domains Returns None:
-
restart
()¶ Reset some private members
-
update_belief_state
(lastact, obs, constraints=None)¶ Does the actual belief tracking via tracker.addTurn
Parameters: - lastact (string) – last system dialgoue act
- obs (list) – current observation
- constraints (dict) –
Returns: dict – previous belief state
-
baseline.py - Baseline Belief Tracker from DST¶
Copyright CUED Dialogue Systems Group 2015 - 2017
Note
This is (essentially) the baseline.py file from the DSTC challenge written by Matt Henderson. It implements the “Baseline” and “Focus” trackers from the DSTC challenge. Some unused things have been removed from the DST version here - just to keep PyDial simple.
See also
CUED Imports/Dependencies:
import utils.Settings
import belieftracking.BeliefTracker.BeliefTracker
import ontology.Ontology
import utils.ContextLogger
-
class
belieftracking.baseline.
BaselineTracker
(domainString)¶ Record single hypothesis for each slot at each turn, whose value is the top scoring value for that slot so far. Note that this tracker does not handle goal constraint changes well as it ignores past states but only uses the current state.
-
class
belieftracking.baseline.
FocusTracker
(domainString)¶ It accumulates evidence and has a simple model of how the state changes throughout the dialogue. Only track goals but not requested slots and method.
BeliefTrackingUtils.py - Belief Tracking Utility Methods¶
Copyright CUED Dialogue Systems Group 2015 - 2017
See also
CUED Imports/Dependencies:
none
-
belieftracking.BeliefTrackingUtils.
order_using
(l, lookup)¶ Return the sorted list of l given the lookup table
Parameters: - l (type) – given list l
- lookup (list) – lookup table
Returns: list – sorted list
-
belieftracking.BeliefTrackingUtils.
print_obs
(obs)¶ Print observations
-
belieftracking.BeliefTrackingUtils.
simplify_belief
(ontology, belief)¶ Make the given belief printable by pruning slot values with less than 0.1 belief
Parameters: - ontology (dict) – a dict includes the informable/requestable slots and info
- belief (dict) – current belief state
Returns: dict – simplified belief