Note
Go to the end to download the full example code.
A robot that asks questions and tracks trust#
Robotics: a robot that asks people questions and tracks their trust.
Questioning design: how should the robot learn people’s unprimed answers?
Human-model ensemble: predicted answers and uncertainty for the robot’s orchestrator.
Trust: does the robot’s question about trust change trust?
All data are simulated from the illustrative domain populations.
import numpy as np
from quantum_mind.applications.robotics import (domain_models, estimate_unprimed_rates, HumanModelEnsemble, TRUST_MODELS, TRUST_EVENTS)
from quantum_mind.families.order_effects import QuantumOrderModel4D, BayesOrderModel, AnchoringOrderModel
from quantum_mind.families.dynamics import question_effect
1. Questioning designs#
How well does each design recover the rate of “yes” to B when B is asked first? Populations are simulated from the quantum-like and the anchoring model.
rng = np.random.default_rng(0)
models = domain_models('object_clarification')
for gen_name in ('QL', 'Anchoring'):
gen = models[gen_name]; truth = gen.predict()['BA'][:2].sum()
for design, model in (('fixed', None), ('split', None), ('probe', QuantumOrderModel4D)):
est = [estimate_unprimed_rates(design, gen, 400, rng, model=model)[1] for _ in range(15)]
print('%-9s people, %-5s design: RMSE of pi_B = %.3f' % (gen_name, design, np.sqrt(np.mean((np.array(est) - truth) ** 2))))
QL people, fixed design: RMSE of pi_B = 0.081
QL people, split design: RMSE of pi_B = 0.033
QL people, probe design: RMSE of pi_B = 0.057
Anchoring people, fixed design: RMSE of pi_B = 0.086
Anchoring people, split design: RMSE of pi_B = 0.044
Anchoring people, probe design: RMSE of pi_B = 0.093
2. Human-model ensemble#
The robot fits competing human models, weights them by BIC and reports a prediction with its uncertainty.
data = models['QL'].sample(None, 300, rng)
ens = HumanModelEnsemble([QuantumOrderModel4D, BayesOrderModel, AnchoringOrderModel]).update(data)
print('\nEnsemble weights:', [(s['model'], round(s['weight'], 3)) for s in ens.summary()])
p, unc = ens.predict('AB'); print('Predicted answers (A first):', p.round(3), 'uncertainty:', {k: round(v, 3) for k, v in unc.items()})
Ensemble weights: [('BayesOrderModel', 0.901), ('QuantumOrderModel4D', 0.099), ('AnchoringOrderModel', 0.0)]
Predicted answers (A first): [0.558 0.003 0.105 0.334] uncertainty: {'entropy_bits': 1.367, 'model_disagreement_bits': 0.0, 'total_bits': 1.368}
3. Trust#
Change in final trust caused by also asking about trust halfway.
print('\nTrust question effect, open-system: %.3f' % question_effect(TRUST_MODELS['open_system'], TRUST_EVENTS, 5, 2))
Trust question effect, open-system: -0.076
Total running time of the script: (0 minutes 33.414 seconds)