PI: Ashish Raj, PhD.
Project Lead (Forward Prediction) : Samuel Wollenburg
Project Lead (Seed Prediction) : Sarah Gomez
Contributors/Advisors : Daren Ma, MSc., Justin Torok, PhD.
Description : This project contains a Physics-Informed Neural Network to both predict the initial seed location and the forward progress of tau tangle concentration in the brain.
./data/: Contains data sets. Normalized data sets are denoted by the suffixnormalized. The predicted seeds provided inseeding_patterns.csvare used in the files with the prefixseeding, otherwise a binary, bilateral entorhinal cortex seeding pattern is used../nexis_model/: Contains various nexis models../model_dictionaries/: Contains the state dictionaries for each model after k-folds of training. Selecting one of these can be used to run the PINN for evaluation.
data_gen.ipynb: To use this file. First start by reading the input data and the connectome. The regions are listed in order from the provided data. Following this, a section for synthetic data generation is seen where a binary, bilateral entorhinal cortex seeding pattern is generated and inserted into the input data, replacing the target tau values. Alternatively, the next section will instead use the predicted seeds from./data/seeding_patterns.csv. Here, the connectome will be reshaped to the size corresponding to the regions available from the seeding patterns. Following this the data is inserted into the input data and both the new connectome and the new data are saved as a csv file with the prefixseeding.data_normalization.ipynb: Contains cells to normalize the datasets provided.- Normalizes
Tau_with_Demographics.csvby subtracting the average value between the the left and right cerebellum cortex with negative values being set to 0. - Normalized
Tau_withDemographics.csvby subtracting one fromAPOE4column to center values on 0 from [0,2] to [-1,1]. - Normalizes
connectome_mean80_fibercount.csvdata to [0, 1] by dividing by the dataset's maximum value. - Creates the lapalcian matrix from
connectome_mean80_fibercount.csv.
- Normalizes
LICENSE: MIT LicensePINN_formward.ipynb: This file allows for data to train the model using k-fold validation. The file contains aTrainerclass which is used to conviently train the model. The trainer is then used within a function namedkFoldthat performs the model training and cross-validation. A PyTorch model and loss function are required as inputs. With the loss function the proportion of loss from the neural network against the target values (targ_prop) and from the Nexis against the target values (nex_prop) can be defined. The loss calculated is the summation of the L1 loss between both terms.kdefines the number of folds during cross validation. The parameterXs,ys, andzscorresponds to the training data input data generated fromdata_gen.ipynb, the target values from the input file, and the values generated from Nexis, respectively. Likewise, the parameterstest_Xs,test_ys, andtest_zscorrespond to the test set. The number of epochs to train for can be set withepochs.draw_curveis a boolean that will output the loss and accuracy curve when set toTrue.early_stopis a boolean that performs early stoping for the models training. While the model will still train for the full number of epochs, the model with the lowest loss will be saved.batch_sizedesignates the batch size used during mini-batch gradient descent. The user can select between optimizerssgd,adam, andadam_l2while also defining the learning rate. Thel1andl2norm have also been added for future use. These parameters adjust for the the proportion of the respective norm to apply.silentcan be set toFalseto enable the progress printing of the model. This will print the loss and accuracy metrics as the model trains for every 100 epochs. The function returns a list of lengthkwhere each element is anp.arraycontaining the predictions on the test data from each model trainined during cross validation.README.md: This file.
- Run data_normalization.ipynb to normalize data.
- Run data_gen.ipynb creating either binary bilateral seeding paterns or using the provided seeding paterns.
- Run PINN_forward.ipynb using the generated .csv files.