API
NCGL Baselines
Bare model
- class NCGL.Baselines.bare_model.NET(*args: Any, **kwargs: Any)
Bare model baseline for NCGL tasks
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
task_manager – Mainly serves to store the indices of the output dimensions corresponding to each task
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(args, g, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the class-IL setting.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (not in use in the current baseline).
dataset – The entire dataset (not in use in the current baseline).
- observe_class_IL_batch(args, g, dataloader, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the class-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
dataloader – The data loader for mini-batch training.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (currently not in use).
dataset – The entire dataset (currently not in use).
- observe_task_IL(args, g, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the task-IL setting.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (not in use in the current baseline).
dataset – The entire dataset (not in use in the current baseline).
- observe_task_IL_batch(args, g, dataloader, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the task-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
dataloader – The data loader for mini-batch training
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (currently not in use).
dataset – The entire dataset (currently not in use).
ER-GNN
- class NCGL.Baselines.ergnn_model.NET(*args: Any, **kwargs: Any)
ER-GNN baseline for NCGL tasks
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
task_manager – Mainly serves to store the indices of the output dimensions corresponding to each task
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(args, g, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the class-IL setting.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class.
dataset – The entire dataset.
- observe_class_IL_batch(args, g, dataloader, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the class-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
dataloader – The data loader for mini-batch training
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (currently not in use).
dataset – The entire dataset (currently not in use).
- observe_task_IL(args, g, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the task-IL setting.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class.
dataset – The entire dataset.
- observe_task_IL_batch(args, g, dataloader, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the task-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
dataloader – The data loader for mini-batch training
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (currently not in use).
dataset – The entire dataset (currently not in use).
EWC
- class NCGL.Baselines.ewc_model.NET(*args: Any, **kwargs: Any)
EWC baseline for NCGL tasks
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
task_manager – Mainly serves to store the indices of the output dimensions corresponding to each task
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(args, g, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the class-IL setting.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (not in use in the current baseline).
dataset – The entire dataset (not in use in the current baseline).
- observe_class_IL_batch(args, g, dataloader, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the class-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
dataloader – The data loader for mini-batch training
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (currently not in use).
dataset – The entire dataset (currently not in use).
- observe_task_IL(args, g, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the task-IL setting.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (not in use in the current baseline).
dataset – The entire dataset (not in use in the current baseline).
- observe_task_IL_batch(args, g, dataloader, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the task-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
dataloader – The data loader for mini-batch training
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (currently not in use).
dataset – The entire dataset (currently not in use).
GEM
- class NCGL.Baselines.gem_model.NET(*args: Any, **kwargs: Any)
GEM baseline for NCGL tasks
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
task_manager – Mainly serves to store the indices of the output dimensions corresponding to each task
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(args, g, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the class-IL setting.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (not in use in the current baseline).
dataset – The entire dataset (not in use in the current baseline).
- observe_class_IL_batch(args, g, dataloader, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the class-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
dataloader – The data loader for mini-batch training
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (currently not in use).
dataset – The entire dataset (currently not in use).
- observe_task_IL(args, g, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the task-IL setting.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (not in use in the current baseline).
dataset – The entire dataset (not in use in the current baseline).
- observe_task_IL_batch(args, g, dataloader, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the task-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
dataloader – The data loader for mini-batch training
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (currently not in use).
dataset – The entire dataset (currently not in use).
Joint
- class NCGL.Baselines.joint_replay_all.NET(*args: Any, **kwargs: Any)
Jointly trained model baseline for NCGL tasks
In this baseline, when ever a new task comes, the model will be jointly trained on all existing tasks.
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
task_manager – Mainly serves to store the indices of the output dimensions corresponding to each task
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(args, gs, featuress, labelss, t, train_idss, ids_per_clss, dataset)
The method for learning the given tasks under the class-IL setting.
- Parameters:
args – Same as the args in __init__().
gs – The graphs of all the existing tasks to be jointly trained on.
featuress – Node features of the nodes in all the existing tasks.
labelss – Labels of the nodes in all the existing tasks.
t – Index of the newest task.
train_idss – The indices of the nodes participating in the training in all the existing tasks.
ids_per_clss – Indices of the nodes in each class of all the existing tasks.
dataset – The entire dataset (not in use in the current baseline).
- observe_class_IL_batch(args, gs, dataloader, featuress, labelss, t, train_idss, ids_per_clss, dataset)
The method for learning the given tasks under the class-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
gs – The graphs of all the existing tasks to be jointly trained on.
dataloader – The data loader for mini-batch training
featuress – Node features of the nodes in all the existing tasks.
labelss – Labels of the nodes in all the existing tasks.
t – Index of the newest task.
train_idss – The indices of the nodes participating in the training in all the existing tasks.
ids_per_clss – Indices of the nodes in each class of all the existing tasks.
dataset – The entire dataset.
- observe_class_IL_crsedge(args, g, features, labels_all, t, train_ids, ids_per_cls_all, dataset)
The method for learning the given tasks under the class-IL setting with inter-task edges.
- Parameters:
args – Same as the args in __init__().
g – The graphs of all the existing tasks to be jointly trained on.
features – Node features of the nodes in all the existing tasks.
labels_all – Labels of the nodes in all the existing tasks.
t – Index of the newest task.
train_ids – The indices of the nodes participating in the training in all the existing tasks.
ids_per_cls_all – Indices of the nodes in each class of all the existing tasks.
dataset – The entire dataset (not in use in the current baseline).
- observe_task_IL(args, gs, featuress, labelss, t, train_idss, ids_per_clss, dataset)
The method for learning the given tasks under the task-IL setting.
- Parameters:
args – Same as the args in __init__().
gs – The graphs of all the existing tasks to be jointly trained on.
featuress – Node features of the nodes in all the existing tasks.
labelss – Labels of the nodes in all the existing tasks.
t – Index of the newest task.
train_idss – The indices of the nodes participating in the training in all the existing tasks.
ids_per_clss – Indices of the nodes in each class of all the existing tasks.
dataset – The entire dataset (not in use in the current baseline).
- observe_task_IL_batch(args, gs, dataloader, featuress, labelss, t, train_idss, ids_per_clss, dataset)
The method for learning the given tasks under the task-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
gs – The graphs of all the existing tasks to be jointly trained on.
dataloader – The data loader for mini-batch training
featuress – Node features of the nodes in all the existing tasks.
labelss – Labels of the nodes in all the existing tasks.
t – Index of the newest task.
train_idss – The indices of the nodes participating in the training in all the existing tasks.
ids_per_clss – Indices of the nodes in each class of all the existing tasks.
dataset – The entire dataset (not in use in the current baseline).
- observe_task_IL_crsedge(args, g, features, labels_all, t, train_ids, ids_per_cls_all, dataset)
The method for learning the given tasks under the task-IL setting with inter-task edges.
- Parameters:
args – Same as the args in __init__().
g – The graphs of all the existing tasks to be jointly trained on.
features – Node features of the nodes in all the existing tasks.
labels_all – Labels of the nodes in all the existing tasks.
t – Index of the newest task.
train_ids – The indices of the nodes participating in the training in all the existing tasks.
ids_per_cls_all – Indices of the nodes in each class of all the existing tasks.
dataset – The entire dataset (not in use in the current baseline).
LwF
- class NCGL.Baselines.lwf_model.NET(*args: Any, **kwargs: Any)
LwF baseline for NCGL tasks
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
task_manager – Mainly serves to store the indices of the output dimensions corresponding to each task
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(args, g, features, labels, t, prev_model, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the class-IL setting.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
prev_model – The model obtained after learning the previous task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (not in use in the current baseline).
dataset – The entire dataset (not in use in the current baseline).
- observe_class_IL_batch(args, g, dataloader, features, labels, t, prev_model, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the class-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
dataloader – The data loader for mini-batch training
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
prev_model – The model obtained after learning the previous task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (currently not in use).
dataset – The entire dataset (currently not in use).
- observe_task_IL(args, g, features, labels, t, prev_model, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the task-IL setting.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
prev_model – The model obtained after learning the previous task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (not in use in the current baseline).
dataset – The entire dataset (not in use in the current baseline).
- observe_task_IL_batch(args, g, dataloader, features, labels, t, prev_model, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the task-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
dataloader – The data loader for mini-batch training
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
prev_model – The model obtained after learning the previous task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (currently not in use).
dataset – The entire dataset (currently not in use).
MAS
- class NCGL.Baselines.mas_model.NET(*args: Any, **kwargs: Any)
MAS baseline for NCGL tasks
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
task_manager – Mainly serves to store the indices of the output dimensions corresponding to each task
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(args, g, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the class-IL setting.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (not in use in the current baseline).
dataset – The entire dataset (not in use in the current baseline).
- observe_class_IL_batch(args, g, dataloader, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the class-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
dataloader – The data loader for mini-batch training
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (currently not in use).
dataset – The entire dataset (currently not in use).
- observe_task_IL(args, g, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the task-IL setting.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (not in use in the current baseline).
dataset – The entire dataset (not in use in the current baseline).
- observe_task_IL_batch(args, g, dataloader, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the task-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
dataloader – The data loader for mini-batch training
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (currently not in use).
dataset – The entire dataset (currently not in use).
TWP
- class NCGL.Baselines.twp_model.NET(*args: Any, **kwargs: Any)
Bare model baseline for NCGL tasks
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
task_manager – Mainly serves to store the indices of the output dimensions corresponding to each task
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(args, g, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the class-IL setting.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (not in use in the current baseline).
dataset – The entire dataset (not in use in the current baseline).
- observe_class_IL_batch(args, g, dataloader, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the class-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
dataloader – The data loader for mini-batch training
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (currently not in use).
dataset – The entire dataset (currently not in use).
- observe_task_IL(args, g, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the task-IL setting.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (not in use in the current baseline).
dataset – The entire dataset (not in use in the current baseline).
- observe_task_IL_batch(args, g, dataloader, features, labels, t, train_ids, ids_per_cls, dataset)
The method for learning the given tasks under the task-IL setting with mini-batch training.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
dataloader – The data loader for mini-batch training
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (currently not in use).
dataset – The entire dataset (currently not in use).
GCGL Baselines
Bare model
- class GCGL.Baselines.bare_model.NET(*args: Any, **kwargs: Any)
Bare model baseline for GCGL tasks
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the task-IL setting with multi-label classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
- observe_clsIL(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the class-IL setting with multi-class classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
- observe_tskIL_multicls(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the task-IL setting with multi-class classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
EWC
- class GCGL.Baselines.ewc_model.NET(*args: Any, **kwargs: Any)
EWC baseline for GCGL tasks
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the task-IL setting with multi-label classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
- observe_clsIL(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the class-IL setting with multi-class classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
- observe_tskIL_multicls(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the task-IL setting with multi-class classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
GEM
- class GCGL.Baselines.gem_model.NET(*args: Any, **kwargs: Any)
Bare model baseline for GCGL tasks
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the task-IL setting with multi-label classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
- observe_clsIL(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the class-IL setting with multi-class classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
- observe_tskIL_multicls(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the task-IL setting with multi-class classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
Joint
- class GCGL.Baselines.jointtrain_model.NET(*args: Any, **kwargs: Any)
Jointly trained model baseline for GCGL tasks
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the task-IL setting with multi-label classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
- observe_clsIL(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the class-IL setting with multi-class classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
- observe_tskIL_multicls(train_loader_joint, loss_criterion, task_i, args)
The method for learning the given tasks under the task-IL setting with multi-class classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
LwF
- class GCGL.Baselines.lwf_model.NET(*args: Any, **kwargs: Any)
LwF baseline for GCGL tasks
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(data_loader, loss_criterion, task_i, args, prev_model)
The method for learning the given tasks under the task-IL setting with multi-label classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
prev_model – The model obtained after learning the previous task.
- observe_clsIL(data_loader, loss_criterion, task_i, args, prev_model)
The method for learning the given tasks under the class-IL setting with multi-class classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
prev_model – The model obtained after learning the previous task.
- observe_tskIL_multicls(data_loader, loss_criterion, task_i, args, prev_model)
The method for learning the given tasks under the task-IL setting with multi-class classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
prev_model – The model obtained after learning the previous task.
MAS
- class GCGL.Baselines.mas_model.NET(*args: Any, **kwargs: Any)
MAS baseline for GCGL tasks
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the task-IL setting with multi-label classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
- observe_clsIL(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the class-IL setting with multi-class classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
- observe_tskIL_multicls(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the task-IL setting with multi-class classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
TWP
- class GCGL.Baselines.twp_model.NET(*args: Any, **kwargs: Any)
TWP baseline for GCGL tasks
- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the task-IL setting with multi-label classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
- observe_clsIL(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the class-IL setting with multi-class classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
- observe_tskIL_multicls(data_loader, loss_criterion, task_i, args)
The method for learning the given tasks under the task-IL setting with multi-class classification datasets.
- Parameters:
data_loader – The data loader for mini-batch training.
loss_criterion – The loss function.
task_i – Index of the current task.
args – Same as the args in __init__().
Utility Functions
- NCGL.visualize.show_final_APAF(result_path, GCGL=False)
The function to show the final AP and AF. Output are orgnized in a LaTex firendly way.
- Parameters:
result_path – The path to the experimental result
- NCGL.visualize.show_learning_curve(result_path, save_fig_name=None)
The function to visualize the dynamics of AP.
- Parameters:
result_path – The path to the experimental result
save_fig_name – If specified, the generated visualization will be stored with the specified name under the directory “./results/figures”
- NCGL.visualize.show_performance_matrices(result_path, save_fig_name=None, multiplier=1.0)
The function to visualize the performance matrix.
- Parameters:
result_path – The path to the experimental result
save_fig_name – If specified, the generated visualization will be stored with the specified name under the directory “./results/figures”
Implementations of New Methods
- class NCGL.Baselines.New_NCGL_model.NET(*args: Any, **kwargs: Any)
A template for implementing new methods for NCGL tasks. The major part for users to care about is the implementation of the function
observe(), which is how the implemented NCGL method learns each new task.- Parameters:
model – The backbone GNNs, e.g. GCN, GAT, GIN, etc.
task_manager – Mainly serves to store the indices of the output dimensions corresponding to each task
args – The arguments containing the configurations of the experiments including the training parameters like the learning rate, the setting confugurations like class-IL and task-IL, etc. These arguments are initialized in the train.py file and can be specified by the users upon running the code.
- observe(args, g, features, labels, t, prev_model, train_ids, ids_per_cls, dataset)
The method for learning the given tasks. Each time a new task is presented, this function will be called to learn the task. Therefore, how the model adapts to new tasks and prevent forgetting on old tasks are all implemented in this function. More detailed comments accompanying the code can be found in the source code of this template in our GitHub repository.
- Parameters:
args – Same as the args in __init__().
g – The graph of the current task.
features – Node features of the current task.
labels – Labels of the nodes in the current task.
t – Index of the current task.
prev_model – The model obtained after learning the previous task.
train_ids – The indices of the nodes participating in the training.
ids_per_cls – Indices of the nodes in each class (not in use in the current baseline).
dataset – The entire dataset (not in use in the current baseline).