예제 #1
0
  R Kiani, TD Hanks, & MN Shadlen, JNS 2008.

  http://dx.doi.org/10.1523/JNEUROSCI.4761-07.2008

"""
from __future__ import division

import numpy as np

from pyrl import tasktools

# Time step
dt = 1

# Inputs
inputs = tasktools.to_map('FIXATION', 'LEFT', 'RIGHT')

# Actions
actions = tasktools.to_map('FIXATE', 'CHOOSE-LEFT', 'CHOOSE-RIGHT')

# Trial conditions
left_rights  = [-1, 1]
cohs         = [0, 6.4, 12.8, 25.6, 51.2]
n_conditions = len(left_rights)*len(cohs)

# Training
n_gradient   = n_conditions
n_validation = 100*n_conditions

# Input noise
sigma = np.sqrt(2*100*0.01)
예제 #2
0
파일: romo.py 프로젝트: frsong/pyrl
A parametric working memory task, based on

  Neuronal population coding of parametric working memory.
  O. Barak, M. Tsodyks, & R. Romo, JNS 2010.

  http://dx.doi.org/10.1523/JNEUROSCI.1875-10.2010

"""
from __future__ import division

import numpy as np

from pyrl import tasktools

# Inputs
inputs = tasktools.to_map('FIXATION', 'F-POS', 'F-NEG')

# Actions
actions = tasktools.to_map('FIXATE', '>', '<')

# Trial conditions
gt_lts = ['>', '<']
fpairs = [(18, 10), (22, 14), (26, 18), (30, 22), (34, 26)]
n_conditions = len(gt_lts) * len(fpairs)

# Training
n_gradient   = n_conditions
n_validation = 20*n_conditions

# Slow down the learning
lr          = 0.002
예제 #3
0
  Representation of confidence associated with a decision by
  neurons in the parietal cortex.
  R. Kiani & M. N. Shadlen, Science 2009.

  http://dx.doi.org/10.1126/science.1169405

"""
from __future__ import division

import numpy as np

from pyrl import tasktools

# Inputs
inputs = tasktools.to_map('FIXATION', 'LEFT', 'RIGHT', 'SURE')

# Actions
actions = tasktools.to_map('FIXATE', 'CHOOSE-LEFT', 'CHOOSE-RIGHT', 'CHOOSE-SURE')

# Trial conditions
wagers       = [True, False]
left_rights  = [-1, 1]
cohs         = [0, 3.2, 6.4, 12.8, 25.6, 51.2]
n_conditions = len(wagers) * len(left_rights) * len(cohs)

# Training
n_gradient   = n_conditions
n_validation = 50*n_conditions

# Input noise
예제 #4
0
Economic choice task, based on

  Neurons in the orbitofrontal cortex encode economic value.
  C Padoa-Schioppa & JA Assad, Nature 2006.

  http://dx.doi.org/10.1038/nature04676

"""
from __future__ import division

import numpy as np

from pyrl import tasktools

# Inputs
inputs = tasktools.to_map('FIXATION', 'L-A', 'L-B', 'R-A', 'R-B', 'N-L', 'N-R')

# Actions
actions = tasktools.to_map('FIXATE', 'CHOOSE-LEFT', 'CHOOSE-RIGHT')

# Trial conditions
A_to_B       = 4.1
juices       = [('A', 'B'), ('B', 'A')]
offers       = [(0, 1), (1, 2), (1, 1), (2, 1), (3, 1),
                (4, 1), (6, 1), (10, 1), (3, 0)]
n_conditions = len(juices) * len(offers)

# Training
n_gradient   = n_conditions
n_validation = 50*n_conditions
예제 #5
0
Multisensory integration, based on

  A category-free neural population supports evolving demands during decision-making.
  D Raposo, MT Kaufman, & AK Churchland, Nature Neurosci. 2014.

  http://dx.doi.org/10.1038/nn.3865

"""
from __future__ import division

import numpy as np

from pyrl import tasktools

# Inputs
inputs = tasktools.to_map('FIXATION', 'VISUAL-P', 'VISUAL-N', 'AUDITORY-P',
                          'AUDITORY-N')

# Actions
actions = tasktools.to_map('FIXATE', 'CHOOSE-LOW', 'CHOOSE-HIGH')

# Trial conditions
mods = ['v', 'a', 'va']
freqs = range(9, 16 + 1)
n_conditions = len(mods) * len(freqs)

# Discrimination boundary
boundary = 12.5

# Training
n_gradient = n_conditions
n_validation = 50 * n_conditions
예제 #6
0
  https://github.com/frsong/pyrl

and add it to your PYTHONPATH, then run the code below. Requires Theano 0.8.2.

"""
import numpy as np

import gym

from pyrl import tasktools

# Environment
env = gym.make('CartPole-v0')

# Inputs
inputs = tasktools.to_map(range(env.observation_space.high.size))

# Actions
actions = tasktools.to_map(range(env.action_space.n))

# Baseline bias
baseline_bout = 0

# Don't treat the last time point as special
abort_on_last_t = False

# Training
n_gradient   = 1
n_validation = 0

# Network structure
예제 #7
0
Economic choice task, based on

  Neurons in the orbitofrontal cortex encode economic value.
  C Padoa-Schioppa & JA Assad, Nature 2006.

  http://dx.doi.org/10.1038/nature04676

"""
from __future__ import division

import numpy as np

from pyrl import tasktools

# Inputs
inputs = tasktools.to_map('FIXATION', 'L-A', 'L-B', 'R-A', 'R-B', 'N-L', 'N-R')

# Actions
actions = tasktools.to_map('FIXATE', 'CHOOSE-LEFT', 'CHOOSE-RIGHT')

# Trial conditions
A_to_B       = 4.1
juices       = [('A', 'B'), ('B', 'A')]
offers       = [(0, 1), (1, 2), (1, 1), (2, 1), (3, 1),
                (4, 1), (6, 1), (10, 1), (3, 0)]
n_conditions = len(juices) * len(offers)

# Training
n_gradient   = n_conditions
n_validation = 50*n_conditions
예제 #8
0
파일: mante.py 프로젝트: sumwor/pylearning
Context-dependent integration task, based on

  Context-dependent computation by recurrent dynamics in prefrontal cortex.
  V Mante, D Sussillo, KV Shinoy, & WT Newsome, Nature 2013.

  http://dx.doi.org/10.1038/nature12742

"""
from __future__ import division

import numpy as np

from pyrl import tasktools

# Inputs
inputs = tasktools.to_map('MOTION', 'COLOR', 'MOTION-LEFT', 'MOTION-RIGHT',
                          'COLOR-LEFT', 'COLOR-RIGHT')

# Actions
actions = tasktools.to_map('FIXATE', 'CHOOSE-LEFT', 'CHOOSE-RIGHT')

# Trial conditions
contexts = ['m', 'c']
left_rights = [-1, 1]
cohs = [5, 15, 50]
n_conditions = len(contexts) * (len(left_rights) * len(cohs))**2

# Training
n_gradient = n_conditions
n_validation = 50 * n_conditions

# Input noise
예제 #9
0
"""
matching pennies task, based on


"""
from __future__ import division

import numpy as np

from pyrl import tasktools

import scipy.stats

# Inputs
inputs = tasktools.to_map('GO', 'L-R', 'R-R', 'L-N', 'R-N')
"""
input situations:
1. go cue
2. left reward
3. right reward
4. left no reward
5. right no reward
"""

# Actions
actions = tasktools.to_map('HOLD', 'CHOOSE-LEFT', 'CHOOSE-RIGHT')

# Trial conditions
#determine what to put here later
#A_to_B       = 2.2
#juices       = [('A', 'B'), ('B', 'A')]
예제 #10
0
파일: romo.py 프로젝트: yulkang/pyrl
A parametric working memory task, based on

  Neuronal population coding of parametric working memory.
  O. Barak, M. Tsodyks, & R. Romo, JNS 2010.

  http://dx.doi.org/10.1523/JNEUROSCI.1875-10.2010

"""
from __future__ import division

import numpy as np

from pyrl import tasktools

# Inputs
inputs = tasktools.to_map('FIXATION', 'F-POS', 'F-NEG')

# Actions
actions = tasktools.to_map('FIXATE', '>', '<')

# Trial conditions
gt_lts = ['>', '<']
fpairs = [(18, 10), (22, 14), (26, 18), (30, 22), (34, 26)]
n_conditions = len(gt_lts) * len(fpairs)

# Training
n_gradient = n_conditions
n_validation = 20 * n_conditions

# Slow down the learning
lr = 0.002
예제 #11
0
파일: cartpole.py 프로젝트: frsong/pyrl
  https://github.com/frsong/pyrl

and add it to your PYTHONPATH, then run the code below. Requires Theano 0.8.2.

"""
import numpy as np

import gym

from pyrl import tasktools

# Environment
env = gym.make('CartPole-v0')

# Inputs
inputs = tasktools.to_map(range(env.observation_space.high.size))

# Actions
actions = tasktools.to_map(range(env.action_space.n))

# Baseline bias
baseline_bout = 0

# Don't treat the last time point as special
abort_on_last_t = False

# Training
n_gradient   = 1
n_validation = 0

# Network structure
예제 #12
0
파일: mante.py 프로젝트: frsong/pyrl
  Context-dependent computation by recurrent dynamics in prefrontal cortex.
  V Mante, D Sussillo, KV Shinoy, & WT Newsome, Nature 2013.

  http://dx.doi.org/10.1038/nature12742

"""
from __future__ import division

import numpy as np

from pyrl import tasktools

# Inputs
inputs = tasktools.to_map('MOTION', 'COLOR',
                          'MOTION-LEFT', 'MOTION-RIGHT',
                          'COLOR-LEFT', 'COLOR-RIGHT')

# Actions
actions = tasktools.to_map('FIXATE', 'CHOOSE-LEFT', 'CHOOSE-RIGHT')

# Trial conditions
contexts     = ['m', 'c']
left_rights  = [-1, 1]
cohs         = [5, 15, 50]
n_conditions = len(contexts) * (len(left_rights)*len(cohs))**2

# Training
n_gradient   = n_conditions
n_validation = 50*n_conditions
예제 #13
0
파일: multisensory.py 프로젝트: frsong/pyrl
Multisensory integration, based on

  A category-free neural population supports evolving demands during decision-making.
  D Raposo, MT Kaufman, & AK Churchland, Nature Neurosci. 2014.

  http://dx.doi.org/10.1038/nn.3865

"""
from __future__ import division

import numpy as np

from pyrl import tasktools

# Inputs
inputs = tasktools.to_map('FIXATION', 'VISUAL-P', 'VISUAL-N', 'AUDITORY-P', 'AUDITORY-N')

# Actions
actions = tasktools.to_map('FIXATE', 'CHOOSE-LOW', 'CHOOSE-HIGH')

# Trial conditions
mods         = ['v', 'a', 'va']
freqs        = range(9, 16+1)
n_conditions = len(mods) * len(freqs)

# Discrimination boundary
boundary = 12.5

# Training
n_gradient   = n_conditions
n_validation = 50*n_conditions