Trial Placement¶
Trial placement strategies for adaptive psychophysical experiments.
Package Overview¶
trial_placement
¶
trial_placement¶
Non-acquisition-based trial placement strategies.
This module provides classical (non-Bayesian-optimization) placement strategies:
- GridPlacement: Fixed grid designs for systematic exploration
- SobolPlacement: Quasi-random low-discrepancy sequences (space-filling)
- StaircasePlacement: Adaptive staircase procedures (e.g., 1-up-2-down)
For acquisition-based adaptive designs (Bayesian optimization), use: - psyphy.acquisition: Expected Improvement, UCB, Mutual Information - See: psyphy.acquisition.optimize_acqf_discrete() for trial selection
Examples:
Classes:
| Name | Description |
|---|---|
GridPlacement |
Fixed grid placement. |
SobolPlacement |
Sobol quasi-random placement. |
StaircasePlacement |
Staircase procedure. |
GridPlacement
¶
Fixed grid placement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_points
|
list of (ref, probe)
|
Predefined set of trial stimuli. |
required |
Notes
- grid = your set of allowable trials.
- this class simply walks through that set.
Methods:
| Name | Description |
|---|---|
propose |
Return the next batch of trials from the grid. |
Attributes:
| Name | Type | Description |
|---|---|---|
grid_points |
|
Source code in src/psyphy/trial_placement/grid.py
propose
¶
propose(posterior, batch_size: int) -> TrialBatch
Return the next batch of trials from the grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
posterior
|
Posterior
|
Ignored in MVP (grid is non-adaptive). |
required |
batch_size
|
int
|
Number of trials to return. |
required |
Returns:
| Type | Description |
|---|---|
TrialBatch
|
Fixed batch of (ref, probe). |
Source code in src/psyphy/trial_placement/grid.py
SobolPlacement
¶
Sobol quasi-random placement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dim
|
int
|
Dimensionality of stimulus space. |
required |
bounds
|
list of (low, high)
|
Bounds per dimension. |
required |
seed
|
int
|
RNG seed. |
0
|
Methods:
| Name | Description |
|---|---|
propose |
Propose Sobol points (ignores posterior). |
Attributes:
| Name | Type | Description |
|---|---|---|
bounds |
|
|
engine |
|
Source code in src/psyphy/trial_placement/sobol.py
propose
¶
propose(posterior, batch_size: int) -> TrialBatch
Propose Sobol points (ignores posterior).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
posterior
|
Posterior
|
Ignored in MVP. |
required |
batch_size
|
int
|
Number of trials to return. |
required |
Returns:
| Type | Description |
|---|---|
TrialBatch
|
Candidate trials from Sobol sequence. |
Notes
MVP: Pure exploration of space. Full WPPM mode: Use Sobol as initialization, then switch to InfoGain.
Source code in src/psyphy/trial_placement/sobol.py
StaircasePlacement
¶
Staircase procedure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_level
|
float
|
Starting stimulus intensity. |
required |
step_size
|
float
|
Step increment. |
required |
rule
|
str
|
Adaptive rule. |
"1up-2down"
|
Methods:
| Name | Description |
|---|---|
propose |
Return next trial(s) based on staircase rule. |
update |
Update staircase level given last response. |
Attributes:
| Name | Type | Description |
|---|---|---|
correct_counter |
|
|
current_level |
|
|
rule |
|
|
step_size |
|
Source code in src/psyphy/trial_placement/staircase.py
propose
¶
propose(posterior, batch_size: int) -> TrialBatch
Return next trial(s) based on staircase rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
posterior
|
Posterior
|
Ignored in MVP (not posterior-aware). |
required |
batch_size
|
int
|
Number of trials to propose. |
required |
Returns:
| Type | Description |
|---|---|
TrialBatch
|
Batch of trials with current staircase level. |
Source code in src/psyphy/trial_placement/staircase.py
update
¶
update(response: int)
Update staircase level given last response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
response
|
int
|
1 = correct, 0 = incorrect. |
required |
Source code in src/psyphy/trial_placement/staircase.py
Grid¶
grid
¶
grid.py
Grid-based placement strategy.
MVP: - Iterates through a fixed list of grid points. - Ignores the posterior (non-adaptive).
Full WPPM mode: - Could refine the grid adaptively around regions of high posterior uncertainty.
Classes:
| Name | Description |
|---|---|
GridPlacement |
Fixed grid placement. |
GridPlacement
¶
Fixed grid placement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_points
|
list of (ref, probe)
|
Predefined set of trial stimuli. |
required |
Notes
- grid = your set of allowable trials.
- this class simply walks through that set.
Methods:
| Name | Description |
|---|---|
propose |
Return the next batch of trials from the grid. |
Attributes:
| Name | Type | Description |
|---|---|---|
grid_points |
|
Source code in src/psyphy/trial_placement/grid.py
propose
¶
propose(posterior, batch_size: int) -> TrialBatch
Return the next batch of trials from the grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
posterior
|
Posterior
|
Ignored in MVP (grid is non-adaptive). |
required |
batch_size
|
int
|
Number of trials to return. |
required |
Returns:
| Type | Description |
|---|---|
TrialBatch
|
Fixed batch of (ref, probe). |
Source code in src/psyphy/trial_placement/grid.py
Sobol¶
sobol
¶
sobol.py
Sobol quasi-random placement.
MVP: - Uses a Sobol engine to generate low-discrepancy points. - Ignores the posterior (pure exploration).
Full WPPM mode: - Could combine Sobol exploration (early) with posterior-aware exploitation (later).
Classes:
| Name | Description |
|---|---|
SobolPlacement |
Sobol quasi-random placement. |
SobolPlacement
¶
Sobol quasi-random placement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dim
|
int
|
Dimensionality of stimulus space. |
required |
bounds
|
list of (low, high)
|
Bounds per dimension. |
required |
seed
|
int
|
RNG seed. |
0
|
Methods:
| Name | Description |
|---|---|
propose |
Propose Sobol points (ignores posterior). |
Attributes:
| Name | Type | Description |
|---|---|---|
bounds |
|
|
engine |
|
Source code in src/psyphy/trial_placement/sobol.py
propose
¶
propose(posterior, batch_size: int) -> TrialBatch
Propose Sobol points (ignores posterior).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
posterior
|
Posterior
|
Ignored in MVP. |
required |
batch_size
|
int
|
Number of trials to return. |
required |
Returns:
| Type | Description |
|---|---|
TrialBatch
|
Candidate trials from Sobol sequence. |
Notes
MVP: Pure exploration of space. Full WPPM mode: Use Sobol as initialization, then switch to InfoGain.
Source code in src/psyphy/trial_placement/sobol.py
Staircase¶
staircase
¶
staircase.py
Classical staircase placement (1-up, 2-down).
MVP: - Purely response-driven, 1D only. - Ignores posterior.
Full WPPM mode: - Extend to multi-D tasks, integrate with WPPM-based discriminability thresholds.
Classes:
| Name | Description |
|---|---|
StaircasePlacement |
Staircase procedure. |
StaircasePlacement
¶
Staircase procedure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_level
|
float
|
Starting stimulus intensity. |
required |
step_size
|
float
|
Step increment. |
required |
rule
|
str
|
Adaptive rule. |
"1up-2down"
|
Methods:
| Name | Description |
|---|---|
propose |
Return next trial(s) based on staircase rule. |
update |
Update staircase level given last response. |
Attributes:
| Name | Type | Description |
|---|---|---|
correct_counter |
|
|
current_level |
|
|
rule |
|
|
step_size |
|
Source code in src/psyphy/trial_placement/staircase.py
propose
¶
propose(posterior, batch_size: int) -> TrialBatch
Return next trial(s) based on staircase rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
posterior
|
Posterior
|
Ignored in MVP (not posterior-aware). |
required |
batch_size
|
int
|
Number of trials to propose. |
required |
Returns:
| Type | Description |
|---|---|
TrialBatch
|
Batch of trials with current staircase level. |
Source code in src/psyphy/trial_placement/staircase.py
update
¶
update(response: int)
Update staircase level given last response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
response
|
int
|
1 = correct, 0 = incorrect. |
required |