model.decision.discrete module

Author:Dominic Hunt

A collection of decision making functions where there are no limits on the number of actions, but they are countable.

model.decision.discrete.maxProb(task_responses=(0, 1))[source]

Decisions for an arbitrary number of choices

Choice made by choosing the most likely

Parameters:task_responses (tuple) – Provides the action responses expected by the tasks for each probability estimate.
Returns:
  • decision_function (function) – Calculates the decisions based on the probabilities and returns the decision and the probability of that decision
  • decision (int or None) – The action to be taken by the model
  • probDict (OrderedDict of valid responses) – A dictionary of considered actions as keys and their associated probabilities as values

See also

models.QLearn(), models.QLearn2(), models.OpAL()

Examples

>>> np.random.seed(100)
>>> d = maxProb([1,2,3])
>>> d([0.6, 0.3, 0.5])
(1, OrderedDict([(1, 0.6), (2, 0.3), (3, 0.5)]))
>>> d([0.2, 0.3, 0.5], trial_responses=[1, 2])
(2, OrderedDict([(1, 0.2), (2, 0.3), (3, 0.5)]))
>>> d([0.2, 0.3, 0.5], trial_responses=[])
(None, OrderedDict([(1, 0.2), (2, 0.3), (3, 0.5)]))
>>> d = maxProb(["A", "B", "C"])
>>> d([0.6, 0.3, 0.5], trial_responses=["A", "B"])
('A', OrderedDict([('A', 0.6), ('B', 0.3), ('C', 0.5)]))
model.decision.discrete.probThresh(task_responses=(0, 1), eta=0.8)[source]

Decisions for an arbitrary number of choices

Choice made by choosing when certain (when probability above a certain value), otherwise randomly

Parameters:
  • task_responses (tuple) – Provides the action responses expected by the tasks for each probability estimate.
  • eta (float, optional) – The value above which a non-random decision is made. Default value is 0.8
Returns:

  • decision_function (function) – Calculates the decisions based on the probabilities and returns the decision and the probability of that decision
  • decision (int or None) – The action to be taken by the model
  • probDict (OrderedDict of valid responses) – A dictionary of considered actions as keys and their associated probabilities as values

Examples

>>> np.random.seed(100)
>>> d = probThresh(task_responses=[0, 1, 2, 3], eta=0.8)
>>> d([0.2, 0.8, 0.3, 0.5])
(1, OrderedDict([(0, 0.2), (1, 0.8), (2, 0.3), (3, 0.5)]))
>>> d([0.2, 0.8, 0.3, 0.5], trial_responses=[0, 2])
(0, OrderedDict([(0, 0.2), (1, 0.8), (2, 0.3), (3, 0.5)]))
>>> d([0.2, 0.8, 0.3, 0.5], trial_responses=[])
(None, OrderedDict([(0, 0.2), (1, 0.8), (2, 0.3), (3, 0.5)]))
>>> d = probThresh(["A","B","C"])
>>> d([0.2, 0.3, 0.8], trial_responses=["A", "B"])
('A', OrderedDict([('A', 0.2), ('B', 0.3), ('C', 0.8)]))
model.decision.discrete.weightProb(task_responses=(0, 1))[source]

Decisions for an arbitrary number of choices

Choice made by choosing randomly based on which are valid and what their associated probabilities are

Parameters:task_responses (tuple) – Provides the action responses expected by the task for each probability estimate.
Returns:
  • decision_function (function) – Calculates the decisions based on the probabilities and returns the decision and the probability of that decision
  • decision (int or None) – The action to be taken by the model
  • probDict (OrderedDict of valid responses) – A dictionary of considered actions as keys and their associated probabilities as values

See also

models.QLearn(), models.QLearn2(), models.OpAL()

Examples

>>> np.random.seed(100)
>>> d = weightProb([0, 1, 2, 3])
>>> d([0.4, 0.8, 0.3, 0.5])
(1, OrderedDict([(0, 0.2), (1, 0.4), (2, 0.15), (3, 0.25)]))
>>> d([0.1, 0.3, 0.4, 0.2])
(1, OrderedDict([(0, 0.1), (1, 0.3), (2, 0.4), (3, 0.2)]))
>>> d([0.2, 0.5, 0.3, 0.5], trial_responses=[0, 2])
(2, OrderedDict([(0, 0.4), (1, 0), (2, 0.6), (3, 0)]))
>>> d = weightProb(["A", "B", "C"])
>>> d([0.2, 0.3, 0.5], trial_responses=["A", "B"])
('B', OrderedDict([('A', 0.4), ('B', 0.6), ('C', 0)]))
>>> d([0.2, 0.3, 0.5], trial_responses=[])
(None, OrderedDict([('A', 0.2), ('B', 0.3), ('C', 0.5)]))