How jameslu01/neural_pk works
Project Type and Purpose
• This is a scientific/machine-learning codebase (not a web app).
• Purpose: apply Neural-ODEs to pharmacokinetics (PK) modeling, compare to LSTM, LightGBM, NLME.
Main Architectural Components
a. Data Layer
• Raw/Example data: ExampleData/sim_data.csv (or clinical dataset upon request).
• Columns: PTNM, STUD, DSFQ, CYCL, AMT, TIME, TFDS, DV.
b. Preprocessing Pipeline
• args.py: parse CLI parameters (data paths, hyperparameters, cross-validation flags).
• data_parse.py: load CSVs, filter/validate columns.
• process_data.py: feature engineering (compute TFDS, cycle counts), normalization.
• data_split.py: either 5-fold cross‐validation splits or cross-dosing schedule splits.
c. Core Modeling Layer
• model.py: defines the Neural-ODE network using PyTorch + torchdiffeq ODE solver.
• utils.py: helper routines (logging, checkpoint I/O, metrics calculation).
d. Pipeline Orchestration Scripts
• run_train.py: coordinates preprocessing → model instantiation → training loop.
• run_predict.py: loads trained weights → performs inference on test/cross-schedule sets.
• run.sh: wrapper shell script that invokes run_train.py and run_predict.py with proper args.
• (cross-schedule only) generate_interp_nodosing.py: specialized interpolation for new dosing regimens.
e. Evaluation & Output
• evaluation.py: computes performance metrics (e.g., RMSE, MAE), generates summary tables.
f. Environment & Dependencies
• environment.yml / requirements.txt: Python 3.7.5, PyTorch 1.5.1, torchdiffeq.
• license.txt: project licensing.
Relationships & Data Flow
• Post‐training: checkpoint → run_predict.py → evaluation.py → figures and metrics output.
• For cross-schedule pipeline, insert generate_interp_nodosing.py between split and predict.
• External libraries (PyTorch, torchdiffeq) sit alongside model.py as dependencies.
Architectural Patterns & Principles
• Modular pipeline: clear separation of parsing, processing, modeling, evaluation.
• Reproducible experiments: use of CLI args, consistent run.sh wrapper.
• Reusable components: utils.py for logging and metrics; same model definition for both pipelines.