{ "info": { "author": "Alex Atanasov, David Brandfonbrener, Daniel Ehrlich, Jasmine Stone", "author_email": "daniel.ehrlich@yale.edu", "bugtrack_url": null, "classifiers": [], "description": "# PsychRNN\n\nThis package is intended to help cognitive scientist easily translate task designs from human or primate behavioral experiments into a form capable of being used as training data for a recurrent neural network.\n\n\nWe have isolated the front-end task design, in which users can intuitively describe the conditional logic of their task from the backend where gradient descent based optimization occurs. This is intended to facilitate researchers who might otherwise not have an easy implementation available to design and test hypothesis regarding the behavior of recurrent neural networks in different task environements.\n\n\nCode is written and upkept by: @davidbrandfonbrener @dbehrlic @ABAtanasov @syncrostone \n\n## Install\n\n### Dependencies\n\n- Numpy\n- Tensorflow\n- Python=2.7 or 3.6\n\nFor Demos:\n- Jupyter\n- Ipython\n- Matplotlib\n\n### Installation\n\ngit clone https://github.com/dbehrlich/PsychRNN.git \ncd PsychRNN \npython setup.py install\n\n#### Alternative Install\n\npip install PsychRNN\n\n\n## 17 Lines Introduction\n\nA minimal introduction to our package. In this simple introduction you can generate a new recurrent neural network model, train that model on the random dot motion discrimination task, and plot out an example output in just 17 lines.\n\n\timport psychrnn \n\tfrom psychrnn.tasks import rdm as rd \n\tfrom psychrnn.backend.models.basic import Basic \n\timport tensorflow as tf \n\n\tfrom matplotlib import pyplot as plt \n\t%matplotlib inline\n\n\trdm = rd.RDM(dt = 10, tau = 100, T = 2000, N_batch = 128) \n\tgen = rdm.batch_generator()\n\n\tparams = rdm.__dict__ \n\tparams['name'] = 'model' \n\tparams['N_rec'] = 50 \n\n\tmodel = Basic(params) \n\tmodel.build() \n\tmodel.train(gen)\n\n\tx,_,_ = next(gen)\n\n\tplt.plot(model.test(x)[0][0,:,:])\n\n\tmodel.destruct()\n\nCode for this example can be found in \"Minimal_Example.ipynb\"\n\n## Demonstration Notebook\n\nFor a more complete tour of training and model parameters see the \"RDM.ipynb\" notebook.\n\n\n## Writing a New Task\n\nYou can easily begin running your own tasks by writing a new task subclass with the two functions (generate_trial_params, trial_function) specified below, or by modifying one of our existing task files such as \"rdm.py\" or \"romo.py\".\n\n\tClass your_new_class(Task):\n\n\t\tdef __init__(self, N_in, N_out, dt, tau, T, N_batch):\n\n\t\t\tsuper(RDM,self).__init__(N_in, N_out, dt, tau, T, N_batch)\n\n\t\t\t\t'''\n\n\t\t\t\tArgs:\n\t\t\t\t\tN_in: number of network inputs\n\t\t\t\t\tN_out: number of network output\n\t\t\t\t\tdt: simulation time step\n\t\t\t\t\ttau: unit time constant\n\t\t\t\t\tT: trial length\n\t\t\t\t\tN_batch: number of trials per training update\n\n\t\t\t\t'''\n\n\t\tdef generate_trial_params(self,batch,trial):\n\n\t\t\t''' function that produces trial specific params for your task (e.g. coherence for the \n\t\t\t\trandom dot motion discrimination task)\n\n\t\t\tArgs:\n\t\t\t\tbatch: # of batch for training (for internal use)\n\t\t\t\ttrial: # of trial within a batch (for internal use)\n\n\t\t\tReturns:\n\t\t\t\tparams: A dictionary of necessary params for trial_function\n\n\t\t\t\t'''\n\n\t\tdef trial_function(self,t,params):\n\n\t\t\t'''function that specifies conditional network input, target output and loss mask for your task at a given time (e.g. if t>stim_onset x_t=1).\n\n\t\t\tArgs:\n\t\t\t\tt: time\n\t\t\t\tparams: params dictionary from generate_trial_params\n\n\t\t\tReturns:\n\t\t\t\tx_t: input vector of length N_in at time t\n\t\t\t\ty_t: target output vector of length N_out at time t\n\t\t\t\tmask_t: loss function mask vector of length N_out at time t\n\n\t\t\t\t'''\n\n## Building a New Model\n\n\nNew models can be added by extending the RNN superclass, as in our examples of \"basic.py\" and \"lstm.py\". Each new model class requires three functions (recurrent_timestep, output time_step and forward_pass).\n\n\tClass your_new_model(RNN):\n\n\t\tdef recurrent_timestep(self, rnn_in, state):\n\n\t\t\t'''function that updates the recurrent state of your network one timestep\n\n\t\t\tArgs:\n\t\t\t\trnn_in: network input vector of length N_in at t\n\t\t\t\tstate: network state at t\n\n\t\t\tReturns:\n\t\t\t\tnew_state: network state at t+1\n\n\t\t\t\t'''\n\n\t\tdef output_timestep(self, state):\n\n\t\t\t'''function that produces output for the current state of your network at one timestep\n\n\t\t\tArgs:\n\t\t\t\tstate: network state at t\n\n\t\t\tReturns:\n\t\t\t\toutput: output vector of length N_out at t\n\n\t\t\t\t'''\n\n\t\tdef forward_pass(self):\n\n\t\t\t'''function that contains the loop of calls to recurrent_timestep and output_timestep\n\t\t\tto run the evolution of your state through a trial \n\n\n\t\t\t\t'''\n\n\n## Further Extensibility\n\nIf you wish to modify weight initializations, loss functions or regularizations it is as simple as adding an additional class to \"initializations.py\" describing your preferred initial weight patterns or a single function to \"loss_functions.py\" or \"regularizations.py\".\n\n### Backend\n\n- initializations\n- loss_functions\n- regularizations\n- rnn\n- simulation\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dbehrlich/PsychRNN", "keywords": "neuroscience,modeling,analysis,neural networks", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "PsychRNN", "package_url": "https://pypi.org/project/PsychRNN/", "platform": "", "project_url": "https://pypi.org/project/PsychRNN/", "project_urls": { "Homepage": "https://github.com/dbehrlich/PsychRNN" }, "release_url": "https://pypi.org/project/PsychRNN/0.3/", "requires_dist": null, "requires_python": "", "summary": "Easy-to-use package for the modeling and analysis of neural network dynamics, directed towards cognitive neuroscientists.", "version": "0.3" }, "last_serial": 4369666, "releases": { "0.3": [ { "comment_text": "", "digests": { "md5": "c317216cd59e5587c42636ef6d8ea575", "sha256": "efc27a956b73e8acf15425d671f3f2c1c9a4050e31e0c53067c3794f533430ea" }, "downloads": -1, "filename": "PsychRNN-0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c317216cd59e5587c42636ef6d8ea575", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16707, "upload_time": "2018-10-12T18:08:13", "url": "https://files.pythonhosted.org/packages/27/65/5310b5a2c6e0a6d68b9dbf3b5fe7be946e106253dbb67b0e318b15aff858/PsychRNN-0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "de1f5c8124d5a2669a1377e919da5efd", "sha256": "0978383990d26f2078a3f108356f6b86f21a4ec6f62c1a486b3724c1c9925e90" }, "downloads": -1, "filename": "PsychRNN-0.3.tar.gz", "has_sig": false, "md5_digest": "de1f5c8124d5a2669a1377e919da5efd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13495, "upload_time": "2018-10-12T18:08:15", "url": "https://files.pythonhosted.org/packages/c9/a0/065c3f7d6432f19065d1e3d676ac9ed133e73cfbb5c54a7b827a542f5649/PsychRNN-0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c317216cd59e5587c42636ef6d8ea575", "sha256": "efc27a956b73e8acf15425d671f3f2c1c9a4050e31e0c53067c3794f533430ea" }, "downloads": -1, "filename": "PsychRNN-0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c317216cd59e5587c42636ef6d8ea575", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16707, "upload_time": "2018-10-12T18:08:13", "url": "https://files.pythonhosted.org/packages/27/65/5310b5a2c6e0a6d68b9dbf3b5fe7be946e106253dbb67b0e318b15aff858/PsychRNN-0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "de1f5c8124d5a2669a1377e919da5efd", "sha256": "0978383990d26f2078a3f108356f6b86f21a4ec6f62c1a486b3724c1c9925e90" }, "downloads": -1, "filename": "PsychRNN-0.3.tar.gz", "has_sig": false, "md5_digest": "de1f5c8124d5a2669a1377e919da5efd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13495, "upload_time": "2018-10-12T18:08:15", "url": "https://files.pythonhosted.org/packages/c9/a0/065c3f7d6432f19065d1e3d676ac9ed133e73cfbb5c54a7b827a542f5649/PsychRNN-0.3.tar.gz" } ] }