Skip to main content

High-dimensional Online Particle Estimation (HOPE) for psychophysical experiments

Project description

High-dimensional Online Particle Estimation (HOPE) for psychophysical experiments

License: MIT PyPI version

HOPE (High-dimensional Online Particle Estimation) is a Python package for adaptive psychophysics experiments.

Given a parametric psychometric function and a discrete stimulus pool, it selects the next stimulus with maximum expected information gain. It uses a posterior approximation based on a combined particle filtering–MCMC approach. This is fast enough for real-time use within the inter-stimulus interval for feature spaces up to 50 dimensions, typically under one second on standard hardware and with a stimulus pool of 10,000 stimuli. The package includes a set of predefined psychometric functions, but users can also supply their own. It is designed to integrate with PsychoPy experiments.

Installation

You can install HOPE using pip:

pip install psihope

Usage

from hope import HopeSampler
from hope.psychometric_functions import logistic_regression
from hope.psychometric_model import BinaryPsychometricModel

# 1. Define your priors
priors = {
    "bias": stats.norm(scale=1),
    "weights": stats.multivariate_normal(mean=np.zeros(2), cov=np.eye(2)),
}

# 2. Define your model
psychometric_model = BinaryPsychometricModel(
    psychometric_function=logistic_regression, # choose from our library of psychometric functions or define your own
    priors=priors,
)

# 3. Initialize the sampler
# define your stimulus pool here as a list of stimulus configurations
stimulus_pool = ... 
sampler = HopeSampler(
    psychometric_model=psychometric_model,
    stimulus_pool=stimulus_pool,
    seed=seed,
)

# 4. Run the experiment
for trial in range(num_trials):
    stimulus = sampler.get_next_stimulus()

    # Collect response from participant using e.g. PsychoPy
    response = ...

    sampler.update_posterior(stimulus, response)

For more advanced usage and more explanations refer to the examples directory.

Citation

TODO

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psihope-0.1.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

psihope-0.1.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file psihope-0.1.0.tar.gz.

File metadata

  • Download URL: psihope-0.1.0.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for psihope-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c5ba4a7e73cb48bb03ea79c551670d1860493c0dad17aa980c21eb14a0eb1f92
MD5 34d06da0594b98dfa9e75133ba0f89d0
BLAKE2b-256 e897010798100ed9badbb35c67bc67a4f40c466031bf5a421e837eb251670592

See more details on using hashes here.

Provenance

The following attestation bundles were made for psihope-0.1.0.tar.gz:

Publisher: release.yml on ag-perception-wallis-lab/hope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file psihope-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: psihope-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for psihope-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 430b74b1807c20314f6323b7a5b16aa1e1cf87aabd60ec065a2872eb4dad7c3d
MD5 e7a7608a7c305729b7f222760b548a03
BLAKE2b-256 f4f2ba1c064d619205846d7c090839df1b2ec7cb6da965be78044d0eb710f788

See more details on using hashes here.

Provenance

The following attestation bundles were made for psihope-0.1.0-py3-none-any.whl:

Publisher: release.yml on ag-perception-wallis-lab/hope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page