Dynamics#

Belief dynamics: how a belief or preference evolves over time, and how intermediate judgements change later ones.

1. Evidence accumulation on N ordered belief states (Busemeyer, Kvam and Pleskac, 2019).

  • MarkovWalk: probability vector \(\phi\), \(\dot\phi = K\phi\), with \(K\) tridiagonal (up rate \(\alpha\), down rate \(\beta\); drift \(\mu = \alpha / (\alpha + \beta)\), rate \(\gamma = \alpha + \beta\)) and reflecting ends.

  • QuantumWalk: amplitude vector \(\psi\), \(U(t) = e^{-iHt}\) with \(H_{jj} = \mu x_j\) (\(x_j = j/(N-1)\)) and \(H_{j,j+1} = H_{j+1,j} = \sigma\).

  • OpenSystemWalk: the quantum walk plus Lindblad dephasing of rate \(\lambda\) in the state basis; \(\lambda = 0\) is the quantum walk, a large \(\lambda\) suppresses interference.

The N states are grouped into K response categories (equal bins). The design is {condition: ('single', t)} for a distribution over the K categories, or {condition: ('joint', t1, t2)} for the K x K joint distribution of judgements at t1 and t2 (flattened row-major). A judgement at t1 collapses the state onto the chosen category, which is how an intermediate judgement can change a later one in the quantum and open-system models but not, on average, in the Markov model.

2. Belief updating over discrete events, queried as yes/no (for example trust in an agent after its successes and failures).

  • MarkovBelief: P(yes) moves toward 1 after a positive event and toward 0 after a negative one; a query only reads the state.

  • OpenSystemBelief: a qubit density matrix rotated by each event, then dephased; a query is a projective measurement.

The design is {condition: (events, queries)}, with events a tuple of 1/0 and queries the event indices after which the question is asked. The prediction is a distribution over the \(2^k\) answer sequences (yes = 1), in itertools.product() order with 1 first.

Classes

MarkovWalk

Classical baseline: Markov random walk over N belief states.

QuantumWalk

Quantum walk over N belief states (Busemeyer, Kvam and Pleskac).

OpenSystemWalk

Quantum walk with Lindblad dephasing.

MarkovBelief

Classical baseline: a yes-probability updated by each event.

OpenSystemBelief

Belief (for example trust) as a qubit.

Functions

final_yes

P(yes) at the last query, marginalised over the earlier answers.

question_effect

Effect of an intermediate question on a later answer.

class MarkovWalk(**kw)[source]#

Bases: _WalkBase

Classical baseline: Markov random walk over N belief states.

A judgement reads the state without disturbing its distribution.

Parameters:
  • mu (float) – Drift, the probability of a step up, in (0, 1).

  • gamma (float) – Total transition rate.

  • n_states (int, optional) – Number of belief states (default 21).

  • n_categories (int, optional) – Number of response categories (default 3).

  • initial_width (float, optional) – Width of the initial Gaussian distribution (default 0.15).

state_probs(t)[source]#

Distribution over belief states.

Parameters:

t (float) – Time.

Returns:

numpy.ndarray – \(e^{Kt}\phi_0\).

joint(t1, t2)[source]#

Joint distribution of judgements at two times.

Parameters:
  • t1 (float) – Times of the two judgements, t1 <= t2.

  • t2 (float) – Times of the two judgements, t1 <= t2.

Returns:

numpy.ndarray – K x K matrix: rows are the category at t1, columns the category at t2.

class QuantumWalk(**kw)[source]#

Bases: _WalkBase

Quantum walk over N belief states (Busemeyer, Kvam and Pleskac).

Evolution is unitary, so an intermediate judgement (a collapse) changes later judgements.

Parameters:
  • mu (float) – Drift (diagonal potential strength).

  • sigma (float) – Diffusion (coupling between neighbouring states).

  • n_states – As in MarkovWalk.

  • n_categories – As in MarkovWalk.

  • initial_width – As in MarkovWalk.

U(t)[source]#

Unitary \(e^{-iHt}\).

Parameters:

t (float) – Time.

Returns:

numpy.ndarray

state_probs(t)[source]#

Distribution over belief states at time t (Born rule).

Parameters:

t (float) – Time.

Returns:

numpy.ndarray

joint(t1, t2)[source]#

Joint distribution of judgements at t1 and t2, with collapse at t1 (Lüders rule).

Parameters:
  • t1 (float) – Times of the two judgements.

  • t2 (float) – Times of the two judgements.

Returns:

numpy.ndarray – K x K joint distribution.

class OpenSystemWalk(**kw)[source]#

Bases: QuantumWalk

Quantum walk with Lindblad dephasing.

Interpolates between the quantum walk (lam = 0) and Markov-like behaviour (large lam).

Parameters:
state_probs(t)[source]#

Distribution over belief states at time t under Lindblad dynamics.

Parameters:

t (float) – Time.

Returns:

numpy.ndarray

joint(t1, t2)[source]#

Joint distribution of judgements at t1 and t2, with collapse at t1.

Parameters:
  • t1 (float) – Times of the two judgements.

  • t2 (float) – Times of the two judgements.

Returns:

numpy.ndarray – K x K joint distribution.

class MarkovBelief(**params)[source]#

Bases: Model

Classical baseline: a yes-probability updated by each event.

Successes raise it, failures lower it; asking does not change it.

Parameters:
  • p0 (float) – Initial P(yes).

  • up (float) – Fraction of the distance to 1 covered after a success.

  • down (float) – Fraction of the distance to 0 covered after a failure.

step(p, e)[source]#

Update the yes-probability after one event.

Parameters:
  • p (float) – Current P(yes).

  • e (int) – 1 for a success, 0 for a failure.

Returns:

float

answer_probs(events, queries)[source]#

Probabilities of the answer sequences.

Parameters:
  • events (sequence of int) – Events (1 success, 0 failure).

  • queries (set of int) – Event indices after which the question is asked.

Returns:

dict – {answers: probability}.

predict(design=None)[source]#

Distribution over answer sequences for each condition.

class OpenSystemBelief(**params)[source]#

Bases: MarkovBelief

Belief (for example trust) as a qubit.

Each event rotates the belief about the y axis; dephasing gamma then pulls it toward the measurement axis; asking collapses it (Lüders rule), so asking can change later answers.

Parameters:
  • phi0 (float) – Initial polar angle on the Bloch sphere (0 is certain “yes”).

  • a_pos (float) – Rotation toward “yes” after a success.

  • a_neg (float) – Rotation toward “no” after a failure.

  • gamma (float) – Dephasing strength per event, in (0, 1).

answer_probs(events, queries)[source]#

Probabilities of the answer sequences (rotation, dephasing, collapse).

Parameters:
  • events (sequence of int) – Events (1 success, 0 failure).

  • queries (set of int) – Event indices after which the question is asked.

Returns:

dict – {answers: probability}.

final_yes(model, events, queries)[source]#

P(yes) at the last query, marginalised over the earlier answers.

Parameters:
  • model (MarkovBelief or OpenSystemBelief) – Belief model.

  • events (sequence of int) – Events.

  • queries (sequence of int) – Query positions; the last one is reported.

Returns:

float

question_effect(model, events, last, intermediate)[source]#

Effect of an intermediate question on a later answer.

Parameters:
  • model (MarkovBelief or OpenSystemBelief) – Belief model.

  • events (sequence of int) – Events.

  • last (int) – Position of the final question.

  • intermediate (int) – Position of the extra, earlier question.

Returns:

float – P(yes at last | also asked at intermediate) - P(yes at last | not asked). Zero for MarkovBelief on average; generally non-zero for OpenSystemBelief.