weightProb¶
-
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"]) (u'B', OrderedDict([(u'A', 0.4), (u'B', 0.6), (u'C', 0)])) >>> d([0.2, 0.3, 0.5], trial_responses=[]) (None, OrderedDict([(u'A', 0.2), (u'B', 0.3), (u'C', 0.5)]))