Skip to content

Commit 5b82187

Browse files
committed
Deployed 6daa413 with MkDocs version: 1.6.1
1 parent 8cd7b7e commit 5b82187

File tree

20 files changed

+15911
-3831
lines changed

20 files changed

+15911
-3831
lines changed

.DS_Store

0 Bytes
Binary file not shown.

api/applications/index.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@
9696
<li class="toctree-l4"><a class="reference internal" href="#cpm.applications.decision_making.PTSM--model-specification">Model Specification</a>
9797
</li>
9898
<li class="toctree-l4"><a class="reference internal" href="#cpm.applications.decision_making.PTSM--model-output">Model output</a>
99+
</li>
100+
<li class="toctree-l4"><a class="reference internal" href="#cpm.applications.decision_making.PTSM--details-for-fitting-the-model-to-data">Details for fitting the model to data</a>
99101
</li>
100102
</ul>
101103
</li>
@@ -104,6 +106,8 @@
104106
<li class="toctree-l4"><a class="reference internal" href="#cpm.applications.decision_making.PTSM1992--model-specification">Model Specification</a>
105107
</li>
106108
<li class="toctree-l4"><a class="reference internal" href="#cpm.applications.decision_making.PTSM1992--model-output">Model output</a>
109+
</li>
110+
<li class="toctree-l4"><a class="reference internal" href="#cpm.applications.decision_making.PTSM1992--details-for-fitting-the-model-to-data">Details for fitting the model to data</a>
107111
</li>
108112
</ul>
109113
</li>
@@ -112,6 +116,8 @@
112116
<li class="toctree-l4"><a class="reference internal" href="#cpm.applications.decision_making.PTSM2025--model-description">Model Description</a>
113117
</li>
114118
<li class="toctree-l4"><a class="reference internal" href="#cpm.applications.decision_making.PTSM2025--model-output">Model Output</a>
119+
</li>
120+
<li class="toctree-l4"><a class="reference internal" href="#cpm.applications.decision_making.PTSM2025--details-for-fitting-the-model-to-data">Details for fitting the model to data</a>
115121
</li>
116122
</ul>
117123
</li>
@@ -290,6 +296,7 @@ <h3 id="cpm.applications.reinforcement_learning.RLRW" class="doc doc-heading">
290296

291297

292298

299+
293300
<div class="doc doc-children">
294301

295302

@@ -302,6 +309,7 @@ <h3 id="cpm.applications.reinforcement_learning.RLRW" class="doc doc-heading">
302309

303310

304311

312+
305313
</div>
306314

307315
</div>
@@ -463,6 +471,9 @@ <h6 id="cpm.applications.decision_making.PTSM--model-output">Model output</h6>
463471
- `u_safe`: the utility of the safe option.
464472
- `u_risk`: the utility of the risky option.
465473
</code></pre>
474+
<h5 id="cpm.applications.decision_making.PTSM--details-for-fitting-the-model-to-data">Details for fitting the model to data</h5>
475+
<p>The model uses a softmax function to map the computed utilities to choice probabilities, with a temperature parameter that controls the stochasticity of the choices. Exponential functions, depending on the temperature parameter, can get out of hand quickly, so it is advisable to keep the temperature parameter within reasonable bounds (e.g., between 0.001 and 20.0).</p>
476+
<p>If you get <strong>overflow warnings</strong> during fitting, consider lowering the upper bound of the temperature parameter. Another possible reason for these <strong>overflow warnings</strong> is that the computed utilities are very large in magnitude. Ensure that the magnitudes in your dataset are within a reasonable range (e.g., between 0 and 1, or -1 and 1). Another option is to z-score the utilities before passing them to the softmax function, which can help stabilize the exponentials. </p>
466477
</details>
467478

468479
<details class="see-also" open>
@@ -485,6 +496,7 @@ <h6 id="cpm.applications.decision_making.PTSM--model-output">Model output</h6>
485496

486497

487498

499+
488500
<div class="doc doc-children">
489501

490502

@@ -497,6 +509,7 @@ <h6 id="cpm.applications.decision_making.PTSM--model-output">Model output</h6>
497509

498510

499511

512+
500513
</div>
501514

502515
</div>
@@ -666,6 +679,9 @@ <h6 id="cpm.applications.decision_making.PTSM1992--model-output">Model output</h
666679
- `u_safe`: the utility of the safe option.
667680
- `u_risk`: the utility of the risky option.
668681
</code></pre>
682+
<h5 id="cpm.applications.decision_making.PTSM1992--details-for-fitting-the-model-to-data">Details for fitting the model to data</h5>
683+
<p>The model uses a softmax function to map the computed utilities to choice probabilities, with a temperature parameter that controls the stochasticity of the choices. Exponential functions, depending on the temperature parameter, can get out of hand quickly, so it is advisable to keep the temperature parameter within reasonable bounds (e.g., between 0.001 and 20.0).</p>
684+
<p>If you get <strong>overflow warnings</strong> during fitting, consider lowering the upper bound of the temperature parameter. Another possible reason for these <strong>overflow warnings</strong> is that the computed utilities are very large in magnitude. Ensure that the magnitudes in your dataset are within a reasonable range (e.g., between 0 and 1, or -1 and 1). Another option is to z-score the utilities before passing them to the softmax function, which can help stabilize the exponentials. </p>
669685
</details>
670686

671687
<details class="see-also" open>
@@ -688,6 +704,7 @@ <h6 id="cpm.applications.decision_making.PTSM1992--model-output">Model output</h
688704

689705

690706

707+
691708
<div class="doc doc-children">
692709

693710

@@ -700,6 +717,7 @@ <h6 id="cpm.applications.decision_making.PTSM1992--model-output">Model output</h
700717

701718

702719

720+
703721
</div>
704722

705723
</div>
@@ -849,6 +867,9 @@ <h6 id="cpm.applications.decision_making.PTSM2025--model-output">Model Output</h
849867
- `u_risk`: The utility of the risky option.
850868
- `dependent`: The computed probability of a risky choice according to the model, which can be used for further analysis or fitting
851869
</code></pre>
870+
<h5 id="cpm.applications.decision_making.PTSM2025--details-for-fitting-the-model-to-data">Details for fitting the model to data</h5>
871+
<p>The model uses a softmax function to map the computed utilities to choice probabilities, with a temperature parameter that controls the stochasticity of the choices. Exponential functions, depending on the temperature parameter, can get out of hand quickly, so it is advisable to keep the temperature parameter within reasonable bounds (e.g., between 0.001 and 20.0).</p>
872+
<p>If you get <strong>overflow warnings</strong> during fitting, consider lowering the upper bound of the temperature parameter. Another possible reason for these <strong>overflow warnings</strong> is that the computed utilities are very large in magnitude. Ensure that the magnitudes in your dataset are within a reasonable range (e.g., between 0 and 1, or -1 and 1). Another option is to z-score the utilities before passing them to the softmax function, which can help stabilize the exponentials. </p>
852873
</details>
853874

854875
<details class="references" open>
@@ -864,6 +885,7 @@ <h6 id="cpm.applications.decision_making.PTSM2025--model-output">Model Output</h
864885

865886

866887

888+
867889
<div class="doc doc-children">
868890

869891

@@ -876,6 +898,7 @@ <h6 id="cpm.applications.decision_making.PTSM2025--model-output">Model Output</h
876898

877899

878900

901+
879902
</div>
880903

881904
</div>
@@ -1062,6 +1085,7 @@ <h3 id="cpm.applications.signal_detection.EstimatorMetaD" class="doc doc-heading
10621085

10631086

10641087

1088+
10651089
<div class="doc doc-children">
10661090

10671091

@@ -1072,6 +1096,7 @@ <h3 id="cpm.applications.signal_detection.EstimatorMetaD" class="doc doc-heading
10721096

10731097

10741098

1099+
10751100
<div class="doc doc-object doc-function">
10761101

10771102

api/datasets/index.html

Lines changed: 115 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
</li>
9090
<li class="toctree-l2"><a class="reference internal" href="#cpm.datasets.load_risky_choices">load_risky_choices</a>
9191
</li>
92+
<li class="toctree-l2"><a class="reference internal" href="#cpm.datasets.load_metacognition_data">load_metacognition_data</a>
93+
</li>
9294
</ul>
9395
</li>
9496
<li class="toctree-l1"><a class="reference internal" href="../models/">cpm.models</a>
@@ -234,18 +236,126 @@ <h3 id="cpm.datasets.load_risky_choices" class="doc doc-heading">
234236

235237
<details class="note" open>
236238
<summary>Notes</summary>
237-
<p>The dataset will include the following columns:</p>
239+
<p>The data are from a risky decision-making task (similar to e.g., Rutledge et al., 2014), a two-alternative forced-choice task, which is implemented as a smartphone-compatible gamified application available in the BrainExplorer app (https://brainexplorer.net/) as the game called "<em>Scavenger</em>".
240+
On each trial, participants are presented with two stimuli and asked to select one of them. After they make their choice, they receive feedback in the form of rewards (coins).
241+
The stimuli are cartoonish depictions of stranded spaceships that participants have to salvage in order to obtain coins.
242+
In addition, participants are shown a radar, two circles drawn at the bottom of the screen, revealing the possible outcomes for each spaceship and their associated probabilities.
243+
One of the spaceships always returns an outcome with 100% probability (i.e., the safe option). The other spaceship has a 50% probability of returning an either a 0 or non-zero outcome (i.e., the risky option).
244+
In gain trials, all possible outcomes are positive (except the outcome of 0). In loss trials, all possible outcomes are negative (except the outcome of 0).
245+
Furthermore, forming an additional within-participant manipulation, trials can be either ambiguous or non-ambiguous.
246+
In ambiguous trials, the radar provides only partial information about the probabilities of the possible outcomes of the risky choice option.
247+
In these trials, the risky choice option is shown to have at least a 25% probability of returning an outcome of 0, and at least a 25% probability of returning a different outcome.
248+
Unbeknownst to the participant, the true probability of both outcomes is always 50/50 (which is why the risky_probability values in the dataset are always 0.5).
249+
Participants play one block with 40 trials, including 10 non-ambiguous gain trials, 10 non-ambiguous loss trials, 10 ambiguous gain trials, and 10 ambiguous loss trials.</p>
250+
<p>The dataset includes the following columns:</p>
238251
<pre><code>- `ppt`: the participant number.
239-
- `safe_magnitudes`: the magnitudes of the safe option.
240-
- `risky_magnitudes`: the magnitudes of the risky options.
241-
- `risky_probability`: the probabilities of the risky options.
252+
- `safe_magnitudes`: the magnitude of the safe option.
253+
- `risky_magnitudes`: the non-zero outcome magnitude of the risky option.
254+
- `risky_probability`: the probability of the risky option.
242255
- `choice`: the choice of the participant (1 for risky, 0 for safe).
243256
- `optimal`: the optimal choice based on expected value (1 for risky, 0 for safe).
244257
- `feedback`: the feedback (reward) given to the participant.
245-
- `ambiguity`: whether the choice was ambiguous (1 for yes, 0 for no).
258+
- `ambiguity`: whether the trial was ambiguous (1 for yes, 0 for no).
246259
- `attempt`: the number of the experimental session for a given participant (e.g. 2 here means that participant is completing the experiment the second time).
247260
- `rt_flip`: the reaction time for the choice, measured in seconds, multiplied by -1 if the choice is not an optimal choice. It is used for fitting various drift diffusion models.
248261
</code></pre>
262+
</details>
263+
264+
<details class="see-also" open>
265+
<summary>See Also</summary>
266+
<p><a class="autorefs autorefs-internal" title="cpm.applications.decision_making.PTSM(data=None, parameters_settings=None, generate=False, utility_curve=None, weighting='tk')" href="../applications/#cpm.applications.decision_making.PTSM">cpm.applications.decision_making.PTSM</a>: simplified version of the Prospect Theory-based Softmax Model (PTSM) for decision-making tasks based on Tversky &amp; Kahneman (1992).</p>
267+
<p><a class="autorefs autorefs-internal" title="cpm.applications.decision_making.PTSM1992(data=None, parameters_settings=None, utility_curve=None, weighting='tk')" href="../applications/#cpm.applications.decision_making.PTSM1992">cpm.applications.decision_making.PTSM1992</a>: full version of the Prospect Theory-based Softmax Model (PTSM) for decision-making tasks based on Tversky &amp; Kahneman (1992).</p>
268+
<p><a class="autorefs autorefs-internal" title="cpm.applications.decision_making.PTSM2025(data=None, parameters_settings=None, utility_curve=None, variant='alpha')" href="../applications/#cpm.applications.decision_making.PTSM2025">cpm.applications.decision_making.PTSM2025</a>: Prospect Theory Softmax Model loosely based on Chew et al. (2019).</p>
269+
</details>
270+
271+
<details class="references" open>
272+
<summary>References</summary>
273+
<p>Rutledge, R. B., Skandali, N., Dayan, P., &amp; Dolan, R. J. (2014). A computational and neural model of momentary subjective well-being. Proceedings of the National Academy of Sciences of the United States of America, 111(33), 12252–12257. https://doi.org/10.1073/pnas.1407535111</p>
274+
</details>
275+
276+
</div>
277+
278+
</div>
279+
280+
<div class="doc doc-object doc-function">
281+
282+
283+
<h3 id="cpm.datasets.load_metacognition_data" class="doc doc-heading">
284+
<code class="highlight language-python"><span class="n">cpm</span><span class="o">.</span><span class="n">datasets</span><span class="o">.</span><span class="n">load_metacognition_data</span><span class="p">()</span></code>
285+
286+
</h3>
287+
288+
289+
<div class="doc doc-contents first">
290+
291+
<p>Load the metacognition dataset from a CSV file.</p>
292+
293+
294+
<table class="field-list">
295+
<colgroup>
296+
<col class="field-name" />
297+
<col class="field-body" />
298+
</colgroup>
299+
<tbody valign="top">
300+
<tr class="field">
301+
<th class="field-name">Returns:</th>
302+
<td class="field-body">
303+
<ul class="first simple">
304+
<li>
305+
<code><span title="pandas.DataFrame">DataFrame</span></code>
306+
307+
<div class="doc-md-description">
308+
<p>A pandas DataFrame containing the metacognition data.</p>
309+
</div>
310+
</li>
311+
</ul>
312+
</td>
313+
</tr>
314+
</tbody>
315+
</table>
316+
317+
<p><span class="doc-section-title">Examples:</span></p>
318+
<div class="highlight"><pre><span></span><code><span class="gp">&gt;&gt;&gt; </span><span class="n">data</span> <span class="o">=</span> <span class="n">load_metacognition_data</span><span class="p">()</span>
319+
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">head</span><span class="p">())</span>
320+
</code></pre></div>
321+
322+
323+
<details class="note" open>
324+
<summary>Notes</summary>
325+
<p>The data are from an experiment combining a perceptual decision making task with an additional post-decision component assessing participants' confidence in their choices (Marzuki et al., 2025; Moses-Payne et al., 2021).
326+
The experiment is implemented as a gamified smartphone-compatible application available in the BrainExplorer platform (https://brainexplorer.net/) as the game "<em>Space Observer</em>".
327+
The task is designed to assess aspects of metacognition, i.e., the extent to which one can accurately reflect on and evaluate their own performance, specifically how well one’s confidence is calibrated to their actual performance.
328+
For a more thorough description of the experimental procedure, please refer to Marzuki et al. (2025).
329+
Briefly, in each trial of the game, participants are presented with a planet in the centre of the screen.
330+
On top of the planet, participants are shown 68 differently coloured aliens for 250 ms, overlaying the planet.
331+
The aliens are drawn from two distinct categories (S1 and S2), which differ in colour, but are identical in shape.
332+
After the 68 aliens disappear, participants are presented with an example of the two differently coloured aliens and asked to choose which of the two had been more abundant on that trial.
333+
After each of the trials, they are asked to indicate how confident they are about their decision on a visual analogue scale ranging from “totally guessing” (0) to “totally certain” (100).
334+
The scale is not labelled with numbers and participants are not informed about the numerical values associated with their confidence ratings.
335+
A staircase procedure (Cornsweet, 1962; García-Pérez, 1998; Levitt, 1971) is used throughout the task to dynamically adjust the stimulus intensity, defined as the difference in aliens required to keep participants’ performance at approximately 70%.</p>
336+
<p>The dataset includes the following columns:</p>
337+
<pre><code>- `participant`: the participant number.
338+
- `signal`: which alien is more abundant (0 = S1, 1 = S2).
339+
- `stimulus_intensity`: absolute difference in number of aliens (i.e., evidence strength).
340+
- `response`: participant's choice (0 = S1, 1 = S2).
341+
- `confidence`: participant's confidence rating for their response.
342+
- `accuracy`: accuracy of the participant's response (0 = incorrect, 1 = correct).
343+
</code></pre>
344+
</details>
345+
346+
<details class="see-also" open>
347+
<summary>See Also</summary>
348+
<p><a class="autorefs autorefs-internal" title="cpm.applications.signal_detection.EstimatorMetaD(data=None, bins=None, cl=None, parallel=False, libraries=['numpy', 'pandas'], prior=False, display=False, ppt_identifier=None, ignore_invalid=False, **kwargs)" href="../applications/#cpm.applications.signal_detection.EstimatorMetaD">cpm.applications.signal_detection.EstimatorMetaD</a>: Class to estimate metacognitive sensitivity (meta-d') from confidence ratings and choices.</p>
349+
</details>
350+
351+
<details class="references" open>
352+
<summary>References</summary>
353+
<p>Chen, Y., Daly, H. R., Pitt, M. A., &amp; Van Zandt, T. (2024). Assessing the distortions introduced when calculating d’: A simulation approach. <em>Behavior Research Methods</em>. https://doi.org/10.3758/s13428-024-02447-8</p>
354+
<p>Cornsweet, T. (1962). The staircase-method in psychophysics. Am. J. Psychol. 75, 485491. https://doi.org/10.2307/1419876</p>
355+
<p>García-Pérez M.A. (1998). Forced-choice staircases with fixed step sizes: asymptotic and small-sample properties. Vision Res., 38(12), 1861-81. https://doi.org/10.1016/s0042-6989(97)00340-4.</p>
356+
<p>Levitt, H. (1971). Transformed up-down methods in psychoacoustics. Journal of the Acoustical Society of America, 49, 467–477. https://doi.org/10.1121/1.1912375</p>
357+
<p>Marzuki, A., Kosina, L., Dome, L., Hewitt, S., &amp; Hauser, T. (2025). Metacognitive antecedents to states of mental ill-health: Drops in confidence precede symptoms of OCD. <em>Research Square</em>. https://doi.org/10.21203/rs.3.rs-7544256/v1</p>
358+
<p>Moses‐Payne, M. E., Habicht, J., Bowler, A., Steinbeis, N., &amp; Hauser, T. U. (2021). I know better! Emerging metacognition allows adolescents to ignore false advice. Developmental Science, 24(5), e13101. https://doi.org/10.1111/desc.13101</p>
249359
</details>
250360

251361
</div>

0 commit comments

Comments
 (0)