Authors

Alexandre Caspers, Grace Jiyoung Yun

Introduction

This project aims to utilize the brainpy library to imitate realistic brain behavior, in order to choose the order in which to perform a given list of tasks. Since the brainpy components need to be heavily adapted to the available tasks, we provide a predefined list of 6 possible tasks.

The user provides the program with wich of the 6 tasks he/she needs to do (possible all), and also which type of work style he/she prefers. For the latter we have 3 predefined choices:

With this information, the program will then return the most optimal order.

In order to do these predictions we train 3 different models (1 for each work style) that get called according to the user input.

Components

Reasons for DRL & BrainPy

Research in the domain of brain and personality is not advanced, so we wanted to give our contribution, as we believe that the more knowledge we have on this topic, the more facinating techniques and tools could be built in the future.

BrainPy is currently one of the most powerful brain modeling libraries there are. It allows for very close definition of the exact brain components we want, the synapses, the resting / reset states of neurons, number of neurons and other intrinsic behaviors of the brain.

However, BrainPy is very slow to use for multiple iterations (1 iteration with 5 task takes about 10 seconds, while 1 iteration with 17 can take up more than 1 minute).

With DRL we want to develop a model that can mimic the decision of the brain model but in significant quicker complexity (since running a NN is just a few matrix computations).

Problems & Solutions

Trained Models Steps

Model low-effort first: Alt text Model high-effort first: Alt text Model alternating-effort first: Alt text

Example BrainPy Iteration

Lower Graph: Input Signals (based on difficulty of the tasks, i.e. physical difficulty determines amplitude, mental difficulty determines duration of a high). Given input activities were: ['workout' 'videogame' 'studying']
Upper Graph: Resulting Brain Activity Alt text

Architecture

.
├── AdaptiveBrain                       # same Structure as Brain/, used for section 2 of frontend
├── Brain
│   ├── caller.py                       # Call the brain code
│   ├── mini_brain.py                   # Core brain model with all the components and synapses
│   ├── plotter.py                      # Plots a Brain model iteration
│   ├── pre_run_brain.py                # Creates the cahed brain activity
│   └── stim.py                         # Input Signal Generation
├── Code_Generation                     # Code to automatically write other python files in relation to tasks.csv (for easy scalability)
│   ├── gen_caller.py
│   ├── gen_minibrain.py
│   ├── gen_plotter.py
│   ├── gen_setup.py
│   └── main_generator.py               # calles all the code generation functions above
├── Data
│   ├── prerun_brain_activities.csv     # Cached brain activities
│   └── tasks.csv                       # Data about tasks to use, and their complexities
├── DRL
│   ├── agent.py                        # Agent, States, Calling training functions
│   ├── model.py                        # The NN part of DRL
│   ├── plotter.py                      # Plots the performance of the trained agent
│   └── rewards.py                      # The different evaluation types of brain activity (3 work styles)
├── drl-model/                          # Saved models
│   ├── model-high_effort_first.h5
│   ├── model-low_effort_first.h5
│   └── model-alternating_effort.h5
├── Pictures/                           # Pictures used in this README
├── ResGraphs/                          # Folder in which we saw the steps chosen in section 2 (and the related matplotlib images)
├── Utils/
│   └── utils.py                        # Auxilary functions to save and access the ResGraphs Folder more easily
├── app.py                              # Frontend
├── main_inference.py                   # Main Code for section 2 of frontend (user defined inputs)
├── main_inference.ipynb                # Main Code during Prediction Phase
├── main_training.ipynb                 # Main Code during Training Phase
├── README.md
├── requirements.txt
└── setup.py                            # Global variables used by some files

References

Links to the BrainPy documentation & research paper:

@article {Wang2022brainpy,
    author = {Wang, Chaoming and Chen, Xiaoyu and Zhang, Tianqiu and Wu, Si},
    title = {BrainPy: a flexible, integrative, efficient, and extensible framework towards general-purpose brain dynamics programming},
    elocation-id = {2022.10.28.514024},
    year = {2022},
    doi = {10.1101/2022.10.28.514024},
    publisher = {Cold Spring Harbor Laboratory},
    URL = {https://www.biorxiv.org/content/early/2022/10/28/2022.10.28.514024},
    eprint = {https://www.biorxiv.org/content/early/2022/10/28/2022.10.28.514024.full.pdf},
    journal = {bioRxiv}
}