Temporal layers
graphs_on_grids.layers.temporal.base
#
GraphBaseConvLSTM
#
Bases: GraphConvLSTM
Implementation of a GraphConvLSTM layer using a GraphBase layer as graph layer.
See the documentation on how temporal layers work.
Source code in graphs_on_grids/layers/temporal/base.py
__init__(adjacency_matrix, embedding_size, hidden_units_node=None, hidden_units_edge=None, dropout_rate=0, use_bias=True, activation=None, weight_initializer='glorot_uniform', weight_regularizer=None, bias_initializer='zeros')
#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency_matrix |
ndarray
|
adjacency matrix of the graphs to be passed to the model |
required |
embedding_size |
int
|
the output dimensionality of the node feature vector |
required |
hidden_units_node |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing node features |
None
|
hidden_units_edge |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing edge features |
None
|
dropout_rate |
int | float
|
The dropout rate used after each dense layer in the node- or edge-MLPs |
0
|
use_bias |
bool
|
Whether to use bias in the hidden layers in the node- and edge-MLPs |
True
|
activation |
str | None
|
Activation function to be used within the layer |
None
|
weight_initializer |
str | Initializer | None
|
Weight initializer to be used within the layer |
'glorot_uniform'
|
weight_regularizer |
str | Regularizer | None
|
Weight regularizer to be used within the layer |
None
|
bias_initializer |
str | Initializer | None
|
Bias initializer to be used within the layer |
'zeros'
|
Source code in graphs_on_grids/layers/temporal/base.py
GraphBaseGRU
#
Bases: GraphGRU
Implementation of a GraphGRU layer using a GraphBase layer as graph layer.
See the documentation on how temporal layers work.
Source code in graphs_on_grids/layers/temporal/base.py
__init__(adjacency_matrix, embedding_size, hidden_units_node=None, hidden_units_edge=None, dropout_rate=0, use_bias=True, activation=None, weight_initializer='glorot_uniform', weight_regularizer=None, bias_initializer='zeros')
#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency_matrix |
ndarray
|
adjacency matrix of the graphs to be passed to the model |
required |
embedding_size |
int
|
the output dimensionality of the node feature vector |
required |
hidden_units_node |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing node features |
None
|
hidden_units_edge |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing edge features |
None
|
dropout_rate |
int | float
|
The dropout rate used after each dense layer in the node- or edge-MLPs |
0
|
use_bias |
bool
|
Whether to use bias in the hidden layers in the node- and edge-MLPs |
True
|
activation |
str | None
|
Activation function to be used within the layer |
None
|
weight_initializer |
str | Initializer | None
|
Weight initializer to be used within the layer |
'glorot_uniform'
|
weight_regularizer |
str | Regularizer | None
|
Weight regularizer to be used within the layer |
None
|
bias_initializer |
str | Initializer | None
|
Bias initializer to be used within the layer |
'zeros'
|
Source code in graphs_on_grids/layers/temporal/base.py
GraphBaseLSTM
#
Bases: GraphLSTM
Implementation of a GraphLSTM layer using a GraphBase layer as graph layer.
See the documentation on how temporal layers work.
Source code in graphs_on_grids/layers/temporal/base.py
__init__(adjacency_matrix, embedding_size, hidden_units_node=None, hidden_units_edge=None, dropout_rate=0, use_bias=True, activation=None, weight_initializer='glorot_uniform', weight_regularizer=None, bias_initializer='zeros')
#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency_matrix |
ndarray
|
adjacency matrix of the graphs to be passed to the model |
required |
embedding_size |
int
|
the output dimensionality of the node feature vector |
required |
hidden_units_node |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing node features |
None
|
hidden_units_edge |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing edge features |
None
|
dropout_rate |
int | float
|
The dropout rate used after each dense layer in the node- or edge-MLPs |
0
|
use_bias |
bool
|
Whether to use bias in the hidden layers in the node- and edge-MLPs |
True
|
activation |
str | None
|
Activation function to be used within the layer |
None
|
weight_initializer |
str | Initializer | None
|
Weight initializer to be used within the layer |
'glorot_uniform'
|
weight_regularizer |
str | Regularizer | None
|
Weight regularizer to be used within the layer |
None
|
bias_initializer |
str | Initializer | None
|
Bias initializer to be used within the layer |
'zeros'
|
Source code in graphs_on_grids/layers/temporal/base.py
GraphBaseTemporalConv
#
Bases: TemporalConv
Implementation of a TemporalConv layer using a GraphBase layer as graph layer.
See the documentation on how temporal layers work.
Source code in graphs_on_grids/layers/temporal/base.py
__init__(adjacency_matrix, embedding_size, output_seq_len, hidden_units_node=None, hidden_units_edge=None, dropout_rate=0, use_bias=True, activation=None, weight_initializer='glorot_uniform', weight_regularizer=None, bias_initializer='zeros')
#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency_matrix |
ndarray
|
adjacency matrix of the graphs to be passed to the model |
required |
embedding_size |
int
|
the output dimensionality of the node feature vector |
required |
output_seq_len |
int
|
number of graphs in the output sequence |
required |
hidden_units_node |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing node features |
None
|
hidden_units_edge |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing edge features |
None
|
dropout_rate |
int | float
|
The dropout rate used after each dense layer in the node- or edge-MLPs |
0
|
use_bias |
bool
|
Whether to use bias in the hidden layers in the node- and edge-MLPs |
True
|
activation |
str | None
|
Activation function to be used within the layer |
None
|
weight_initializer |
str | Initializer | None
|
Weight initializer to be used within the layer |
'glorot_uniform'
|
weight_regularizer |
str | Regularizer | None
|
Weight regularizer to be used within the layer |
None
|
bias_initializer |
str | Initializer | None
|
Bias initializer to be used within the layer |
'zeros'
|
Source code in graphs_on_grids/layers/temporal/base.py
graphs_on_grids.layers.temporal.conv
#
GraphConvTemporalConv
#
Bases: TemporalConv
Implementation of a TemporalConv layer using a GraphConvolution layer as graph layer.
See the documentation on how temporal layers work.
Source code in graphs_on_grids/layers/temporal/conv.py
__init__(adjacency_matrix, embedding_size, output_seq_len, hidden_units_node=None, hidden_units_edge=None, dropout_rate=0, use_bias=True, activation=None, weight_initializer='glorot_uniform', weight_regularizer=None, bias_initializer='zeros')
#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency_matrix |
ndarray
|
adjacency matrix of the graphs to be passed to the model |
required |
embedding_size |
int
|
the output dimensionality of the node feature vector |
required |
output_seq_len |
int
|
number of graphs in the output sequence |
required |
hidden_units_node |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing node features |
None
|
hidden_units_edge |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing edge features |
None
|
dropout_rate |
int | float
|
The dropout rate used after each dense layer in the node- or edge-MLPs |
0
|
use_bias |
bool
|
Whether to use bias in the hidden layers in the node- and edge-MLPs |
True
|
activation |
str | None
|
Activation function to be used within the layer |
None
|
weight_initializer |
str | Initializer | None
|
Weight initializer to be used within the layer |
'glorot_uniform'
|
weight_regularizer |
str | Regularizer | None
|
Weight regularizer to be used within the layer |
None
|
bias_initializer |
str | Initializer | None
|
Bias initializer to be used within the layer |
'zeros'
|
Source code in graphs_on_grids/layers/temporal/conv.py
GraphConvolutionConvLSTM
#
Bases: GraphConvLSTM
Implementation of a GraphConvLSTM layer using a GraphConvolution layer as graph layer.
See the documentation on how temporal layers work.
Source code in graphs_on_grids/layers/temporal/conv.py
__init__(adjacency_matrix, embedding_size, hidden_units_node=None, hidden_units_edge=None, dropout_rate=0, use_bias=True, activation=None, weight_initializer='glorot_uniform', weight_regularizer=None, bias_initializer='zeros')
#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency_matrix |
ndarray
|
adjacency matrix of the graphs to be passed to the model |
required |
embedding_size |
int
|
the output dimensionality of the node feature vector |
required |
hidden_units_node |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing node features |
None
|
hidden_units_edge |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing edge features |
None
|
dropout_rate |
int | float
|
The dropout rate used after each dense layer in the node- or edge-MLPs |
0
|
use_bias |
bool
|
Whether to use bias in the hidden layers in the node- and edge-MLPs |
True
|
activation |
str | None
|
Activation function to be used within the layer |
None
|
weight_initializer |
str | Initializer | None
|
Weight initializer to be used within the layer |
'glorot_uniform'
|
weight_regularizer |
str | Regularizer | None
|
Weight regularizer to be used within the layer |
None
|
bias_initializer |
str | Initializer | None
|
Bias initializer to be used within the layer |
'zeros'
|
Source code in graphs_on_grids/layers/temporal/conv.py
GraphConvolutionGRU
#
Bases: GraphGRU
Implementation of a GraphGRU layer using a GraphConvolution layer as graph layer.
See the documentation on how temporal layers work.
Source code in graphs_on_grids/layers/temporal/conv.py
__init__(adjacency_matrix, embedding_size, hidden_units_node=None, hidden_units_edge=None, dropout_rate=0, use_bias=True, activation=None, weight_initializer='glorot_uniform', weight_regularizer=None, bias_initializer='zeros')
#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency_matrix |
ndarray
|
adjacency matrix of the graphs to be passed to the model |
required |
embedding_size |
int
|
the output dimensionality of the node feature vector |
required |
hidden_units_node |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing node features |
None
|
hidden_units_edge |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing edge features |
None
|
dropout_rate |
int | float
|
The dropout rate used after each dense layer in the node- or edge-MLPs |
0
|
use_bias |
bool
|
Whether to use bias in the hidden layers in the node- and edge-MLPs |
True
|
activation |
str | None
|
Activation function to be used within the layer |
None
|
weight_initializer |
str | Initializer | None
|
Weight initializer to be used within the layer |
'glorot_uniform'
|
weight_regularizer |
str | Regularizer | None
|
Weight regularizer to be used within the layer |
None
|
bias_initializer |
str | Initializer | None
|
Bias initializer to be used within the layer |
'zeros'
|
Source code in graphs_on_grids/layers/temporal/conv.py
GraphConvolutionLSTM
#
Bases: GraphLSTM
Implementation of a GraphLSTM layer using a GraphConvolution layer as graph layer.
See the documentation on how temporal layers work.
Source code in graphs_on_grids/layers/temporal/conv.py
__init__(adjacency_matrix, embedding_size, hidden_units_node=None, hidden_units_edge=None, dropout_rate=0, use_bias=True, activation=None, weight_initializer='glorot_uniform', weight_regularizer=None, bias_initializer='zeros')
#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency_matrix |
ndarray
|
adjacency matrix of the graphs to be passed to the model |
required |
embedding_size |
int
|
the output dimensionality of the node feature vector |
required |
hidden_units_node |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing node features |
None
|
hidden_units_edge |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing edge features |
None
|
dropout_rate |
int | float
|
The dropout rate used after each dense layer in the node- or edge-MLPs |
0
|
use_bias |
bool
|
Whether to use bias in the hidden layers in the node- and edge-MLPs |
True
|
activation |
str | None
|
Activation function to be used within the layer |
None
|
weight_initializer |
str | Initializer | None
|
Weight initializer to be used within the layer |
'glorot_uniform'
|
weight_regularizer |
str | Regularizer | None
|
Weight regularizer to be used within the layer |
None
|
bias_initializer |
str | Initializer | None
|
Bias initializer to be used within the layer |
'zeros'
|
Source code in graphs_on_grids/layers/temporal/conv.py
graphs_on_grids.layers.temporal.attention
#
GraphAttentionConvLSTM
#
Bases: GraphConvLSTM
Implementation of a GraphConvLSTM layer using a GraphAttention layer as graph layer.
See the documentation on how temporal layers work.
Source code in graphs_on_grids/layers/temporal/attention.py
__init__(adjacency_matrix, embedding_size, hidden_units_node=None, hidden_units_attention=None, dropout_rate=0, use_bias=True, activation=None, weight_initializer='glorot_uniform', weight_regularizer=None, bias_initializer='zeros')
#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency_matrix |
ndarray
|
adjacency matrix of the graphs to be passed to the model |
required |
embedding_size |
int
|
the output dimensionality of the node feature vector |
required |
hidden_units_node |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing node features |
None
|
hidden_units_attention |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for computing attention scores |
None
|
dropout_rate |
int | float
|
The dropout rate used after each dense layer in the node- or edge-MLPs |
0
|
use_bias |
bool
|
Whether to use bias in the hidden layers in the node- and edge-MLPs |
True
|
activation |
str | None
|
Activation function to be used within the layer |
None
|
weight_initializer |
str | Initializer | None
|
Weight initializer to be used within the layer |
'glorot_uniform'
|
weight_regularizer |
str | Regularizer | None
|
Weight regularizer to be used within the layer |
None
|
bias_initializer |
str | Initializer | None
|
Bias initializer to be used within the layer |
'zeros'
|
Source code in graphs_on_grids/layers/temporal/attention.py
GraphAttentionGRU
#
Bases: GraphGRU
Implementation of a GraphGRU layer using a GraphAttention layer as graph layer.
See the documentation on how temporal layers work.
Source code in graphs_on_grids/layers/temporal/attention.py
__init__(adjacency_matrix, embedding_size, hidden_units_node=None, hidden_units_attention=None, dropout_rate=0, use_bias=True, activation=None, weight_initializer='glorot_uniform', weight_regularizer=None, bias_initializer='zeros')
#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency_matrix |
ndarray
|
adjacency matrix of the graphs to be passed to the model |
required |
embedding_size |
int
|
the output dimensionality of the node feature vector |
required |
hidden_units_node |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing node features |
None
|
hidden_units_attention |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for computing attention scores |
None
|
dropout_rate |
int | float
|
The dropout rate used after each dense layer in the node- or edge-MLPs |
0
|
use_bias |
bool
|
Whether to use bias in the hidden layers in the node- and edge-MLPs |
True
|
activation |
str | None
|
Activation function to be used within the layer |
None
|
weight_initializer |
str | Initializer | None
|
Weight initializer to be used within the layer |
'glorot_uniform'
|
weight_regularizer |
str | Regularizer | None
|
Weight regularizer to be used within the layer |
None
|
bias_initializer |
str | Initializer | None
|
Bias initializer to be used within the layer |
'zeros'
|
Source code in graphs_on_grids/layers/temporal/attention.py
GraphAttentionLSTM
#
Bases: GraphLSTM
Implementation of a GraphLSTM layer using a GraphAttention layer as graph layer.
See the documentation on how temporal layers work.
Source code in graphs_on_grids/layers/temporal/attention.py
__init__(adjacency_matrix, embedding_size, hidden_units_node=None, hidden_units_attention=None, dropout_rate=0, use_bias=True, activation=None, weight_initializer='glorot_uniform', weight_regularizer=None, bias_initializer='zeros')
#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency_matrix |
ndarray
|
adjacency matrix of the graphs to be passed to the model |
required |
embedding_size |
int
|
the output dimensionality of the node feature vector |
required |
hidden_units_node |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing node features |
None
|
hidden_units_attention |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for computing attention scores |
None
|
dropout_rate |
int | float
|
The dropout rate used after each dense layer in the node- or edge-MLPs |
0
|
use_bias |
bool
|
Whether to use bias in the hidden layers in the node- and edge-MLPs |
True
|
activation |
str | None
|
Activation function to be used within the layer |
None
|
weight_initializer |
str | Initializer | None
|
Weight initializer to be used within the layer |
'glorot_uniform'
|
weight_regularizer |
str | Regularizer | None
|
Weight regularizer to be used within the layer |
None
|
bias_initializer |
str | Initializer | None
|
Bias initializer to be used within the layer |
'zeros'
|
Source code in graphs_on_grids/layers/temporal/attention.py
GraphAttentionTemporalConv
#
Bases: TemporalConv
Implementation of a TemporalConv layer using a GraphAttention layer as graph layer.
See the documentation on how temporal layers work.
Source code in graphs_on_grids/layers/temporal/attention.py
__init__(adjacency_matrix, embedding_size, output_seq_len, hidden_units_node=None, hidden_units_attention=None, dropout_rate=0, use_bias=True, activation=None, weight_initializer='glorot_uniform', weight_regularizer=None, bias_initializer='zeros')
#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency_matrix |
ndarray
|
adjacency matrix of the graphs to be passed to the model |
required |
embedding_size |
int
|
the output dimensionality of the node feature vector |
required |
output_seq_len |
int
|
number of graphs in the output sequence |
required |
hidden_units_node |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for processing node features |
None
|
hidden_units_attention |
list | tuple
|
list or tuple of neuron counts in the hidden layers used in the MLP for computing attention scores |
None
|
dropout_rate |
int | float
|
The dropout rate used after each dense layer in the node- or edge-MLPs |
0
|
use_bias |
bool
|
Whether to use bias in the hidden layers in the node- and edge-MLPs |
True
|
activation |
str | None
|
Activation function to be used within the layer |
None
|
weight_initializer |
str | Initializer | None
|
Weight initializer to be used within the layer |
'glorot_uniform'
|
weight_regularizer |
str | Regularizer | None
|
Weight regularizer to be used within the layer |
None
|
bias_initializer |
str | Initializer | None
|
Bias initializer to be used within the layer |
'zeros'
|
Source code in graphs_on_grids/layers/temporal/attention.py
graphs_on_grids.layers.temporal.output_layer
#
ConvOutputBlock
#
Bases: Layer
Convolutional output layer to be used with implementations of the TemporalConv layers.
A 2D-Convolution is applied to create graphs according to the parameter output_seq_len. At the output,
a dense layer adjusts the graphs to the embedding size given by the units parameter.
Source code in graphs_on_grids/layers/temporal/output_layer.py
__init__(output_seq_len, units, activation=None)
#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_seq_len |
int
|
number of graphs in the output sequence |
required |
units |
int
|
embedding size of the output graph(s) |
required |
activation |
str
|
activation function of the dense output layer |
None
|
Source code in graphs_on_grids/layers/temporal/output_layer.py
RecurrentOutputBlock
#
Bases: Layer
Recurrent output layer to be used with implementations of the GraphLSTM, GraphGRU and GraphConvLSTM layers.
The last output of the last temporal layer is taken and passed through a dense layer with units * output_seq_len
neurons. The output is then reshaped to generate output_seq_len graphs with embedding size units.
Source code in graphs_on_grids/layers/temporal/output_layer.py
__init__(output_seq_len, units, activation=None)
#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_seq_len |
int
|
number of graphs in the output sequence |
required |
units |
int
|
embedding size of the output graph(s) |
required |
activation |
str
|
activation function of the dense output layer |
None
|