How mocherson/medgcn works
Project Type & Purpose
• This is a research/experimental deep learning project implementing a graph convolutional network (GCN) for medical applications.
• The main experiments include tasks such as node classification (via nodeclassify.py) and link prediction (via linkpredict.py). The repository is structured to both load and preprocess medical data and then use that processed data to train/test graph neural network models.
File Structure & Mapping to Components
• Data Layer:
• The "data" directory contains CSV files (e.g., enc_date.csv, inter_enc_lab.csv, inter_enc_med.csv, inter_enc_pat.csv) which serve as raw input data for the experiments.
• These files represent the medical data inputs which the system interacts with.
• Preprocessing/Utility Layer:
• The "preparedata.py" script, along with modules under the "utility" directory (iofile.py, preprocessing.py, rank_metrics.py), indicates that there is a dedicated data preprocessing and metrics evaluation stage.
• This layer handles data cleaning, formatting, and computes evaluation metrics.
• Model & Architecture Layer:
• Files such as model.py, layers.py, inductive.py, and inits.py contribute to the definition and initialization of the GCN architecture.
• These modules encapsulate core parts of the neural network, including layer definitions, model initialization, and possibly both forward and backward passes for training.
• Experiment/Task Layer:
• The main experiment runners nodeclassify.py and linkpredict.py are entry points for executing specific tasks – node classification and link prediction experiments respectively.
• These scripts combine the data layer, preprocessing utilities, and model components to run end-to-end training and evaluation processes.
a. Main Components:
• Data Source: CSV files in the "data" folder.
• Data Preprocessing Module: "preparedata.py" and utility functions from "utility" (preprocessing, iofile).
• GCN Model and Initialization: "model.py", "layers.py", "inits.py", "inductive.py".
• Experiment Runner: Node Classification (nodeclassify.py), Link Prediction (linkpredict.py).
• Evaluation Module: "utility/rank_metrics.py" for performance metrics.
b. Relationships and Data Flow:
• From Data Preprocessing, data is fed into the GCN Model block (composed of model definitions and layer architectures).
c. Architectural Patterns and Key Technologies:
• That the project leverages PyTorch for model implementation and training.
• That the design follows a modular and layered approach: separating data handling, model construction, and experiment execution.
• That clear abstraction boundaries exist (data preprocessing vs. model layers vs. experiment code), which aids extensibility and debugging.
d. Relevant Technologies, Frameworks, and Libraries:
• PyTorch as the core NN framework.
• CSV-based data handling (could be implemented via Pandas or built-in CSV libraries, as implied by the data files and iofile.py utility).
• Custom graph convolution layers and inductive modules defined in the code.