This is an implementation of lightGBM and SHAP to predict the probability of an animal making a false alarm, miss, or hit using gradient-boosted regression and classification trees (PLOS Computational Biology, in press, doi: https://doi.org/10.1371/journal.pcbi.1011985). This code assumes you have put your behavioural data into a pandas dataframe where each factor or variable of interest is represented as a column.
To set up:
- Install python 3.9 (in this repository I used conda)
- git clone this repository
- cd into the repository
- run
pip install -r requirements.txt
; the main requirements are the SHAP package, pandas, and lightGBM. - navigate to the models directory
- run the selected model, i.e.
runfalsealarmmodel.py
for the false alarm model
runfalsealarmmodel.py
- classifier to predict whether there will be a false alarm during a catch trialreactiontimemodel.py
- regression model, predicts the reaction times of correct target trialsreactiontimeforFAandtargmodel.py
- regression model, predicts the absolute reaction time relative to the trial start solely based on the words presented in the trialcorrectrespmissmodel.py
- predicts the probability of a miss/correct response during a target trial.
plotstatsacrossanimals.py
- plots general psychophysics metrics
- Put your data into a pandas dataframe where each column is a variable of interest
- Change data paths as relevant and column names as relevant
- Use optuna to fine tune your hyperparameters
- Run the finalised model