Skip to content

Antibias ignores the per-condition probability prior #11

Description

@alexevag

Antibias ignores the per-condition probability prior

Summary

When trial_selection is staircase or biased with antibias enabled, the realized condition distribution does not follow the experimenter-defined prior. With random the same prior is honored. Over 150 trials, staircase+antibias drifts toward a balanced/uniform distribution instead of the intended one.

Where

src/ethopy/core/experiment.py

  • _random_selection (line ~680)
  • _anti_bias (line ~635)
  • _staircase_selection (line ~713)
  • _biased_selection (line ~739)
  • un_choices / un_blocks setup in log_conditions (line ~478)

Root cause

random honors the prior because it samples self.conditions directly:

return np.random.choice(self.conditions)

This is a uniform draw over the conditions list, whose multiplicity encodes the prior (A×3, B×3, C×4 → 30/30/40).

The antibias path discards that multiplicity in two places:

  1. self.un_choices = np.unique(...) — antibias operates only on unique [response_port, difficulty] choices, so it can't see that C appeared 4× and A only 3×.
  2. _anti_bias returns a choice with fixed_p = 1 - mean(recent == choice),normalized. That deliberately drives presentation toward equalizing the animal's recent choices (uniform target), not toward the experimenter prior.
  3. The final np.random.choice(valid_conditions) is also uniform among the conditions matching the chosen choice.

result: with antibias the distribution depends on how many unique choices A/B/C map to and on the animal's behavior

This is "working as designed" for antibias (bias correction targets uniform), but it is incompatible with also reproducing a fixed prior.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions