tumourkit.classification.train_graphs

Script to train and save several GNN configurations.

Copyright (C) 2023 Jose Pérez Cano

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Contact information: joseperez2000@hotmail.es

Functions

append_results

Appends result to given filename.

compute_neural_persistence

Computes normalized neural persistence of the model using Gudhi.

create_results_file

Creates header of .csv result file to append results.

evaluate

Evaluates model in loader.

fuse_loaders

Concatenates both loaders into one.

generate_configurations

Generates a grid in the search space with no more than max_confs configurations.

load_dataset

Creates Torch dataloaders for training. Folder structure: node_dir: - train - graphs - file1.nodes.csv ... - validation - graphs - file1.nodes.csv ... - test - graphs - file1.nodes.csv .

load_model

Available models: GCN, ATT, HATT, SAGE, GIN Configuration space: NUM_LAYERS, DROPOUT, NORM_TYPE

main

main_with_args

name_from_conf

Generates a name from the configuration object.

save_model

Save model weights and configuration file to SAVE_DIR

train

Train the model with early stopping on either: F1 score (weighted) or neural persistence, or until 1000 iterations.

train_one_conf

train_one_iter

Trains for one iteration, as the name says.