topobench.utils.config_resolvers module#

Configuration resolvers for the topobench package.

check_pses_in_transforms(transforms)#

Check if there are positional or structural encodings in the transforms.

Parameters:
transformsDictConfig

Configuration parameters for the transforms.

Returns:
bool

True if there are positional or structural encodings, False otherwise.

get_default_metrics(task, metrics=None)#

Get default metrics for a given task.

Parameters:
taskstr

Task, either “classification” or “regression”.

metricslist, optional

List of metrics to be used. If None, the default metrics will be used.

Returns:
list

List of default metrics.

Raises:
ValueError

If the task is invalid.

get_default_trainer()#

Get default trainer configuration.

Returns:
str

Default trainer configuration file name.

get_default_transform(dataset, model)#

Get default transform for a given data domain and model.

Parameters:
datasetstr

Dataset name. Should be in the format “data_domain/name”.

modelstr

Model name. Should be in the format “model_domain/name”.

Returns:
str

Default transform.

get_flattened_channels(num_nodes, channels)#

Get the output dimension of flattening a feature matrix.

Parameters:
num_nodesint

Hidden dimension for the first layer.

channelsint

Channel dimension.

Returns:
int

Flatenned cchannels dimension.

get_monitor_metric(task, metric)#

Get monitor metric for a given task.

Parameters:
taskstr

Task, either “classification” or “regression”.

metricstr

Name of the metric function.

Returns:
str

Monitor metric.

Raises:
ValueError

If the task is invalid.

get_monitor_mode(task)#

Get monitor mode for a given task.

Parameters:
taskstr

Task, either “classification” or “regression”.

Returns:
str

Monitor mode, either “max” or “min”.

Raises:
ValueError

If the task is invalid.

get_non_relational_out_channels(num_nodes, channels, task_level)#

Get the output dimension for a non-relational model.

Parameters:
num_nodesint

Number of nodes in the input graph.

channelsint

Channel dimension.

task_levelint

Task level for the model.

Returns:
int

Output dimension.

get_required_lifting(data_domain, model)#

Get required transform for a given data domain and model.

Parameters:
data_domainstr

Dataset domain.

modelstr

Model name. Should be in the format “model_domain/name”.

Returns:
str

Required transform.

infer_in_channels(dataset, transforms)#

Infer the number of input channels for a given dataset.

Parameters:
datasetDictConfig

Configuration parameters for the dataset.

transformsDictConfig

Configuration parameters for the transforms.

Returns:
list

List with dimensions of the input channels.

infer_num_cell_dimensions(selected_dimensions, in_channels)#

Infer the length of a list.

Parameters:
selected_dimensionslist

List of selected dimensions. If not None it will be used to infer the length.

in_channelslist

List of input channels. If selected_dimensions is None, this list will be used to infer the length.

Returns:
int

Length of the input list.

infer_topotune_num_cell_dimensions(neighborhoods)#

Infer the length of a list.

Parameters:
neighborhoodslist

List of neighborhoods.

Returns:
int

Length of the input list.