topobench.nn.encoders package#

Init file for encoder module with automated encoder discovery.

class AllCellFeatureEncoder(in_channels, out_channels, proj_dropout=0, selected_dimensions=None, **kwargs)#

Bases: AbstractFeatureEncoder

Encoder class to apply BaseEncoder.

The BaseEncoder is applied to the features of higher order structures. The class creates a BaseEncoder for each dimension specified in selected_dimensions. Then during the forward pass, the BaseEncoders are applied to the features of the corresponding dimensions.

Parameters:
in_channelslist[int]

Input dimensions for the features.

out_channelslist[int]

Output dimensions for the features.

proj_dropoutfloat, optional

Dropout for the BaseEncoders (default: 0).

selected_dimensionslist[int], optional

List of indexes to apply the BaseEncoders to (default: None).

**kwargsdict, optional

Additional keyword arguments.

__init__(in_channels, out_channels, proj_dropout=0, selected_dimensions=None, **kwargs)#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(data)#

Forward pass.

The method applies the BaseEncoders to the features of the selected_dimensions.

Parameters:
datatorch_geometric.data.Data

Input data object which should contain x_{i} features for each i in the selected_dimensions.

Returns:
torch_geometric.data.Data

Output data object with updated x_{i} features.

class DGMStructureFeatureEncoder(in_channels, out_channels, proj_dropout=0, selected_dimensions=None, **kwargs)#

Bases: AbstractFeatureEncoder

Encoder class to apply BaseEncoder.

The BaseEncoder is applied to the features of higher order structures. The class creates a BaseEncoder for each dimension specified in selected_dimensions. Then during the forward pass, the BaseEncoders are applied to the features of the corresponding dimensions.

Parameters:
in_channelslist[int]

Input dimensions for the features.

out_channelslist[int]

Output dimensions for the features.

proj_dropoutfloat, optional

Dropout for the BaseEncoders (default: 0).

selected_dimensionslist[int], optional

List of indexes to apply the BaseEncoders to (default: None).

**kwargsdict, optional

Additional keyword arguments.

__init__(in_channels, out_channels, proj_dropout=0, selected_dimensions=None, **kwargs)#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(data)#

Forward pass.

The method applies the BaseEncoders to the features of the selected_dimensions.

Parameters:
datatorch_geometric.data.Data

Input data object which should contain x_{i} features for each i in the selected_dimensions.

Returns:
torch_geometric.data.Data

Output data object with updated x_{i} features.

class FlatEncoder(in_channels, out_channels, **kwargs)#

Bases: AbstractFeatureEncoder

Abstract class to define a custom feature encoder.

Parameters:
in_channelsint

Number of input channels.

out_channelsint

Number of output channels.

**kwargs

Additional keyword arguments.

__init__(in_channels, out_channels, **kwargs)#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(data)#

Forward pass of the flat encoder.

Parameters:
datatorch_geometric.data.Data

Input data object which should contain x features.

Returns:
torch_geometric.data.Data

Output data object with flattened features.

Submodules#