ICEWS18Dataset

class dgl.data.ICEWS18Dataset(mode='train', raw_dir=None, force_reload=False, verbose=False, transform=None)[source]

Bases: dgl.data.dgl_dataset.DGLBuiltinDataset

ICEWS18 dataset for temporal graph

Integrated Crisis Early Warning System (ICEWS18)

Event data consists of coded interactions between socio-political actors (i.e., cooperative or hostile actions between individuals, groups, sectors and nation states). This Dataset consists of events from 1/1/2018 to 10/31/2018 (24 hours time granularity).

Reference:

Statistics:

  • Train examples: 240

  • Valid examples: 30

  • Test examples: 34

  • Nodes per graph: 23033

Parameters
  • mode (str) – Load train/valid/test data. Has to be one of [‘train’, ‘valid’, ‘test’]

  • raw_dir (str) – Raw file directory to download/contains the input data directory. Default: ~/.dgl/

  • force_reload (bool) – Whether to reload the dataset. Default: False

  • verbose (bool) – Whether to print out progress information. Default: True.

  • transform (callable, optional) – A transform that takes in a DGLGraph object and returns a transformed version. The DGLGraph object will be transformed before every access.

is_temporal

Is the dataset contains temporal graphs

Type

bool

Examples

>>> # get train, valid, test set
>>> train_data = ICEWS18Dataset()
>>> valid_data = ICEWS18Dataset(mode='valid')
>>> test_data = ICEWS18Dataset(mode='test')
>>>
>>> train_size = len(train_data)
>>> for g in train_data:
....    e_feat = g.edata['rel_type']
....    # your code here
....
>>>
__getitem__(idx)[source]

Get graph by index

Parameters

idx (int) – Item index

Returns

The graph contains:

  • edata['rel_type']: edge type

Return type

dgl.DGLGraph

__len__()[source]

Number of graphs in the dataset.

Returns

Return type

int