morphoclass.models.bidirectional_net module¶
Implementation of the BidirectionalNet classifier.
-
class
morphoclass.models.bidirectional_net.BidirectionalNet(num_classes, num_nodes_features)¶ Bases:
torch.nn.modules.module.ModuleModel for classifying morphologies of pyramidal neurons.
This is the architecture that performed best in the TensorFlow implementation. It consists of two graph convolutions layers with each computing two convolutions: one on the directed adjacency matrix, and one with the adjacency matrix with the reversed direction. The results of both convolutions are concatenated and passed to the next layer. After the two parallel graph convolutions follows a global average pooling layer and a fully-connected layer. Finally, a softmax layer is used for prediction.
- Parameters
num_classes (int) – The number of output classes.
num_nodes_features (int) – The number of input node features.
-
accuracy(data)¶ Run the forward pass and compute the accuracy.
- Parameters
data (torch_geometric.data.Data) – The input batch of data.
- Returns
acc – The accuracy on the current data batch.
- Return type
float
-
forward(data)¶ Compute the forward pass.
- Parameters
data (torch_geometric.data.data.Data) – A batch of input data.
- Returns
The log softmax of the predictions.
- Return type
log_softmax
-
loss_acc(data)¶ Run the forward pass and compute the loss and accuracy.
- Parameters
data (torch_geometric.data.Data) – The input batch of data.
- Returns
loss (float) – The loss on the given data batch.
acc (float) – The accuracy on the current data batch.
-
training: bool¶