Git Product home page Git Product logo

esantorella / aepsych Goto Github PK

View Code? Open in Web Editor NEW

This project forked from facebookresearch/aepsych

0.0 0.0 0.0 20.18 MB

AEPsych is a tool for adaptive experimentation in psychophysics and perception research, built on top of gpytorch and botorch.

License: Other

Shell 0.04% JavaScript 0.64% Python 6.88% C# 2.26% MATLAB 0.07% CSS 0.42% TeX 14.06% Makefile 0.01% HTML 40.41% Batchfile 0.01% Jupyter Notebook 34.28% HLSL 0.14% ShaderLab 0.78%

aepsych's Introduction

AEPsych

AEPsych is a framework and library for adaptive experimetation in psychophysics and related domains.

Installation

AEPsych only supports python 3.8+. We recommend installing AEPsych under a virtual environment like Anaconda. Once you've created a virtual environment for AEPsych and activated it, you can install AEPsych using pip:

pip install aepsych

If you're a developer or want to use the latest features, you can install from GitHub using:

git clone https://github.com/facebookresearch/aepsych.git
cd aepsych
pip install -r requirements.txt
pip install -e .

Usage

See the code examples here.

The canonical way of using AEPsych is to launch it in server mode (you can run aepsych_server --help to see additional arguments):

aepsych_server --port 5555 --ip 0.0.0.0 database --db mydatabase.db

The server accepts messages over either a unix socket or ZMQ, and all messages are formatted using JSON. All messages have the following format:

{
     "type":<TYPE>,
     "version":<VERSION>,
     "message":<MESSAGE>,
}

Version can be omitted, in which case we default to the oldest / unversioned handler for this message type. There are five message types: setup, resume, ask, tell and exit.

Setup

The setup message prepares the server for making suggestions and accepting data. The setup message can be formatted as either INI or a python dict (similar to JSON) format, and an example for psychometric threshold estimation is given in configs/single_lse_example.ini. It looks like this:

{
    "type":"setup",
    "version":"0.01",
    "message":{"config_str":<PASTED CONFIG STRING>}
}

After receiving a setup message, the server responds with a strategy index that can be used to resume this setup (for example, for interleaving multiple experiments).

Resume

The resume message tells the server to resume a strategy from earlier in the same run. It looks like this:

{
    "type":"resume",
    "version":"0.01",
    "message":{"strat_id":"0"}
}

After receiving a resume message, the server responds with the strategy index resumed.

Ask

The ask message queries the server for the next trial configuration. It looks like this:

{
    "type":"ask",
    "version":"0.01",
    "message":""
}

After receiving an ask message, the server responds with a configuration in JSON format, for example {"frequency":100, "intensity":0.8}

Tell

The tell message updates the server with the outcome for a trial configuration. Note that the tell does not need to match with a previously ask'd trial. For example, if you are interleaving AEPsych runs with a classical staircase, you can still feed AEPsych with the staircase data. A message looks like this:

{
    "type":"tell",
    "version":"0.01",
    "message":{
        "config":{
                "frequency":100,
                "intensity":0.8
            },
        "outcome":"1",
    }
}

Exit

The exit message tells the server to close the socket connection, write strats into the database and terminate current session. The message is:

{
    "type":"exit",
}

The server closes the connection.

Data export and visualization

The data is logged to a SQLite database on disk (by default, databases/default.db). The database has one table containing all experiment sessions that were run. Then, for each experiment there is a table containing all messages sent and received by the server, capable of supporting a full replay of the experiment from the server's perspective. This table can be summarized into a data frame output (docs forthcoming) and used to visualize data (docs forthcoming).

Contributing

See the CONTRIBUTING file for how to help out.

License

AEPsych licensed CC-BY-NC 4.0, as found in the LICENSE file.

Citing

The AEPsych paper is currently under review. In the meanwhile, you can cite our preprint:

Owen, L., Browder, J., Letham, B., Stocek, G., Tymms, C., & Shvartsman, M. (2021). Adaptive Nonparametric Psychophysics. http://arxiv.org/abs/2104.09549

aepsych's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.