GLITask
- class gli.task.GLITask(task_dict, pwd, device='cpu')
Bases:
object
The basic GLI task class for creating graph learning tasks.
This class contains the necessary attributes and methods for all GLI tasks.
- Parameters:
task_dict (dict) – A dictionary containing the task information.
pwd (str) – The path to the directory containing the task files.
device (str) – The device to load the task data to.
Notes
The
task_dict
should at least contain the following keys:type
: The type of the task.description
: A description of the task.feature
: A list of features to use for the task.target
: The target to use for the task.
The
gli.task.GLITask
class also contains split information. There are two split methods supported by GLI tasks: random split and predefined split.If the random split is used, the
task_dict
should contain the following keys:train_ratio
: The ratio of training samples.val_ratio
: The ratio of validation samples.test_ratio
: The ratio of test samples.num_samples
: The number of samples used in random sampling.seed
: The random seed to use for random sampling. (optional)
Otherwise, in the predefined split method, the
task_dict
should contain the following keys:train_set
: The path to the file containing the training set.val_set
: The path to the file containing the validation set.test_set
: The path to the file containing the test set.
Other optional keys include:
num_splits
: The number of splits to use for the task. (optional, 1 by default)
Warning
Instantiating a
gli.task.GLITask
object directly is still experimental. Instead, you should use thegli.task.read_gli_task()
orgli.dataloading.get_gli_task()
to load tasks from files.- __init__(task_dict, pwd, device='cpu')
Initialize GLITask.
This method will infer whether to use random split or predefined split and then load the split information into
GLITask.splits
.