Giter VIP home page Giter VIP logo

adopy's Introduction

ADOpy

PyPI Project Status: Active – The project has reached a stable, usable state and is being actively developed. Travis CI CodeCov

ADOpy is a Python implementation of Adaptive Design Optimization (ADO; Myung, Cavagnaro, & Pitt, 2013), which computes optimal designs dynamically in an experiment. Its modular structure permit easy integration into existing experimentation code.

ADOpy supports Python 3.6 or above and relies on NumPy, SciPy, and Pandas.

Features

  • Grid-based computation of optimal designs using only three classes: adopy.Task, adopy.Model, and adopy.Engine.
  • Easily customizable for your own tasks and models
  • Pre-implemented Task and Model classes including:
    • Psychometric function estimation for 2AFC tasks (adopy.tasks.psi)
    • Delay discounting task (adopy.tasks.ddt)
    • Choice under risk and ambiguity task (adopy.tasks.cra)
  • Example code for experiments using PsychoPy (link)

Installation

# Install from PyPI
pip install adopy

# Install from Github (developmental version)
pip install git+https://github.com/adopy/adopy.git@develop

Resources

Citation

If you use ADOpy, please cite this package along with the specific version. It greatly encourages contributors to continue supporting ADOpy.

Yang, J., Pitt, M. A., Ahn, W., & Myung, J. I. (2020). ADOpy: A Python Package for Adaptive Design Optimization. Behavior Research Methods, 1-24. https://doi.org/10.3758/s13428-020-01386-4

Acknowledgement

The research was supported by National Institute of Health Grant R01-MH093838 to Mark A. Pitt and Jay I. Myung, the Basic Science Research Program through the National Research Foundation (NRF) of Korea funded by the Ministry of Science, ICT, & Future Planning (NRF-2018R1C1B3007313 and NRF-2018R1A4A1025891), the Institute for Information & Communications Technology Planning & Evaluation (IITP) grant funded by the Korea government (MSIT) (No. 2019-0-01367, BabyMind), and the Creative-Pioneering Researchers Program through Seoul National University to Woo-Young Ahn.

References

  • Myung, J. I., Cavagnaro, D. R., and Pitt, M. A. (2013). A tutorial on adaptive design optimization. Journal of Mathematical Psychology, 57, 53–67.

adopy's People

Contributors

jaeyeongyang avatar markapitt avatar nicholaswon47 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adopy's Issues

Multiple variables for responses (e.g., choice, RT)

Since the current version of ADOPy (0.3.1) largely focus on the binary choice response, it cannot be extended to tasks with both choice and RT. To make it generalizable to multiple response variables, Task and Engine classes should be updated.

Using eligibility traces to avoid choosing the same design repeatedly

After the posteriors on model parameters converge to a certain degree, ADO provides the same design as an optimal one repeatedly. However, providing the same design repeatedly makes participants feel "something wrong" on the task, which distracts their task performance.

To avoid it, researchers can use filler trials as randomly chosen or pre-determined. However, I thought it would be better for ADOpy engines to consider the history of designs used by themselves. So, inspired by the SARSA(λ) model in the reinforcement learning field (Sutton & Barto, 1998; 2018), using eligibility traces for choosing an optimal design independently to Bayesian updating may solve the issue.

Examples in the documentation should be elaborated more

As ADOpy includes several implementations for specific tasks and models, it would be great to include detailed examples for these implementations. However, the current examples somewhat lack descriptions in plain English.

The example files should be included in /docs/source/examples as Jupyter notebook files. If the notebook file is properly executed, it can be automatically integrated into the Sphinx-based documentation (based on nbsphinx).

merging repos

I recommend placing the Psychopy and Jupyter examples in this repo. Keep everything associated with ADOypy in a single repo. Merge /psychopy-tasks into this one. The main repo should be a one-stop shop for everything ADOpy.

Am I overlooking something?

Make it possible to use custom priors

The current implementation of ADOpy uses the uniform prior by default, and there is no explicit way to use custom priors. Although users can overwrite Engine.log_prior with custom log priors even in the current version, it is not straightforward. Adding a new feature for custom priors would help users customize the ADOpy engine for their preferences.

AttributeError

After installing adopy, I attempt to load the module but I get the following error:
AttributeError: module 'numpy' has no attribute 'int'. 'np.int' was a deprecated alias for the builtin 'int'. To avoid this error in existing code, use 'int' by itself. Doing this will not modify any behavior and is safe. When replacing 'np.int', you may wish to use e.g. 'np.int64' or 'np.int32' to specify the precision. If you wish to review your current use, check the release note link for additional information.

I found a solution online to change the code in ~/opt/miniconda/envs/adopy/lib/python3.9/site-packages/adopy/types.py from np.int to np.int_ and np.float to np.float_
Potential solution: https://stackoverflow.com/questions/74946845/attributeerror-module-numpy-has-no-attribute-int

Documentation accessibility

Make the documentation more easily accessible. There is only one link. Is it part of the repo or not? There is a folder named "docs."

Examples, please

A detailed example of how to use each task needs to be provided, with lots of text explaining what is going on and why. I see one for psychometric function estimation. In addition to breaking the code up into commented sections, include in the repo under "examples" the full Psychopy program that works. Use the same keyboard response for all tasks. Maybe 10 trials. Maybe also add a version in simulation mode, too. As you note in the ms, it is really valuable to see ADO work with differing grid resolutions.

We want users to copy and paste the code into an IDE and have ADO working immediately for them.
.

Abstraction for task-model structure

From issue #3, I stuck with a problem dealing with models with a different number of parameters. So, I'd like to solve it by adding new classes for tasks and models, e.g., TaskInfo, ModelInfo. I'll add comments with detailed ideas.

Python version

Why the restriction to 3.6? I worry a bit that some will not want to upgrade. 3.5 is still a default for versions of tensorflow, for example. Maybe there will be few in our workshop who use it. Are there issues with 3.5?

Add models for the Delayed Discounting task

  • Exponential model (Samuelson, 1937)
  • Hyperbolic model (Mazur, 1987)
  • Generalized Hyperbolic model (Loewenstein & Prelec, 1992; Green & Myerson 2004)
  • Quasi-Hyperbolic (Beta-Delta) model (Phelps & Pollak, 1968)
  • Double Exponential model (McClure et al., 2007)
  • Constant Sensitivity model (Ebert & Prelec, 2007)

Documentation

Prior to submission of the ADOpy ms, how much of this site should be user-ready?

  • The application examples should be embedded in the Wiki or in the Readme. Should the examples be expanded? We need some minimal amount of documentation here. It could be quite elaborate.
  • I suggest we support only Python 3. By not supporting 2.7 we might lose some customers, but they should switch to 3.
  • We need to add links on how to install the other dependencies. Should we recommend Ananconda or Miniconda? What is the easiest way to ensure a clean and trouble-free installation of Python? This is what we want to recommend.

version

With the release and publication, we should start using versioning explicitly on the site so users can keep track of updates. I know Jaeyeong has been using it, but it should be explicit on GH and in the manuscript.

The release should be updated in README.md. THere must be automated ways to do this.

Psychometric function estimation

To increase the usefulness of the package, it is important to have a method of estimating the threshold of a psychometric function (two choices). This will be very popular in some disciplines. I cannot remember whether we discussed this before, so decided to create this issue. To be most useful, the more complex model should be used with parameters for lapse rate and guessing, but set defaults for these values as I suspect many users will not be interested in them.

Use Github Actions for CI

I found that travis-ci.org is ceased since June 15th, 2021, and it might be better to find one to replace it for continuous integration. One good candidate is Github Actions, which provides an automative workflow integrated with the Github repository.

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.