Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

PINN - UCSF Brain Networks Lab

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.

Subdirectories

  • ./data/ : Contains data sets. Normalized data sets are denoted by the suffix normalized. The predicted seeds provided in seeding_patterns.csv are used in the files with the prefix seeding, 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.

Files

  • 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 prefix seeding.
  • data_normalization.ipynb : Contains cells to normalize the datasets provided.
    • Normalizes Tau_with_Demographics.csv by subtracting the average value between the the left and right cerebellum cortex with negative values being set to 0.
    • Normalized Tau_withDemographics.csv by subtracting one from APOE4 column to center values on 0 from [0,2] to [-1,1].
    • Normalizes connectome_mean80_fibercount.csv data to [0, 1] by dividing by the dataset's maximum value.
    • Creates the lapalcian matrix from connectome_mean80_fibercount.csv.
  • LICENSE : MIT License
  • PINN_formward.ipynb : This file allows for data to train the model using k-fold validation. The file contains a Trainer class which is used to conviently train the model. The trainer is then used within a function named kFold that 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. k defines the number of folds during cross validation. The parameter Xs , ys , and zs corresponds to the training data input data generated from data_gen.ipynb, the target values from the input file, and the values generated from Nexis, respectively. Likewise, the parameters test_Xs, test_ys, and test_zs correspond to the test set. The number of epochs to train for can be set with epochs. draw_curve is a boolean that will output the loss and accuracy curve when set to True. early_stop is 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_size designates the batch size used during mini-batch gradient descent. The user can select between optimizers sgd , adam , and adam_l2 while also defining the learning rate. The l1 and l2 norm have also been added for future use. These parameters adjust for the the proportion of the respective norm to apply. silent can be set to False to 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 length k where each element is a np.array containing the predictions on the test data from each model trainined during cross validation.
  • README.md : This file.

To Run

  1. Run data_normalization.ipynb to normalize data.
  2. Run data_gen.ipynb creating either binary bilateral seeding paterns or using the provided seeding paterns.
  3. Run PINN_forward.ipynb using the generated .csv files.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages