gninatorch.transforms module

PyTorch-Ignite output transformations.

Note

PyTorch-Ignite output_transform arguments allow to transform the Engine.state.output for the intendend use (by ignite.metrics and ignite.handlers).

gninatorch.transforms.output_transform_ROC(output) Tuple[Tensor, Tensor][source]

Output transform for the ROC curve.

Parameters:

output – Engine output

Returns:

Positive class probability and associated labels.

Return type:

Tuple[torch.Tensor, torch.Tensor]

Notes

https://pytorch.org/ignite/generated/ignite.contrib.metrics.ROC_AUC.html#roc-auc

gninatorch.transforms.output_transform_ROC_flex(output) Tuple[Tensor, Tensor][source]

Output transform for the ROC curve (for flexible residues pose)

Parameters:

output – Engine output

Returns:

Positive class probability and associated labels.

Return type:

Tuple[torch.Tensor, torch.Tensor]

Notes

https://pytorch.org/ignite/generated/ignite.contrib.metrics.ROC_AUC.html#roc-auc

gninatorch.transforms.output_transform_select_affinity(output: Dict[str, Tensor]) Tuple[Tensor, Tensor][source]

Select predicted affinities output and experimental (target) affinities from output dictionary.

Parameters:

output (Dict[str, ignite.metrics.Metric]) – Engine output

Returns:

Predicted binding affinity and experimental (target) binding affinity

Return type:

Tuple[torch.Tensor, torch.Tensor]

Notes

This function is used as output_transform in ignite.metrics.metric.Metric and allow to select affinity predictions from the dictionary that the evaluator returns.

gninatorch.transforms.output_transform_select_affinity_abs(output: Dict[str, Tensor]) Tuple[Tensor, Tensor][source]

Select predicted affinities (in absolute value) and experimental (target) affinities from output dictionary.

Parameters:

output (Dict[str, ignite.metrics.Metric]) – Engine output

Returns:

Predicted binding affinity (absolute value) and experimental binding affinity

Return type:

Tuple[torch.Tensor, torch.Tensor]

Notes

This function is used as output_transform in ignite.metrics.metric.Metric and allow to select affinity predictions from the dictionary that the evaluator returns.

Affinities can have negative values when they are associated to bad poses. The sign is used by AffinityLoss, but in order to compute standard metrics the absolute value is needed, which is returned here.

gninatorch.transforms.output_transform_select_flex(output: Dict[str, Tensor]) Tuple[Tensor, Tensor][source]

Select flexible residues pose softmax output and labels from output dictionary.

Parameters:

output (Dict[str, ignite.metrics.Metric]) – Engine output

Returns:

Class probabilities and class labels

Return type:

Tuple[torch.Tensor, torch.Tensor]

Notes

This function is used as output_transform in ignite.metrics.metric.Metric and allow to select pose results from the dictionary that the evaluator returns.

The output is activated, i.e. the log_softmax output is transformed into softmax.

gninatorch.transforms.output_transform_select_log_flex(output: Dict[str, Tensor]) Tuple[Tensor, Tensor][source]

Select flexible residues pose log_softmax output and labels from output dictionary.

Parameters:

output (Dict[str, ignite.metrics.Metric]) – Engine output

Returns:

Logarithm of the pose class probabilities (log_softmax) and class label

Return type:

Tuple[torch.Tensor, torch.Tensor]

Notes

This function is used as output_transform in ignite.metrics.metric.Metric and allow to select pose results from the dictionary that the evaluator returns.

The output is not activated, i.e. the log_softmax output is returned unchanged

gninatorch.transforms.output_transform_select_log_pose(output: Dict[str, Tensor]) Tuple[Tensor, Tensor][source]

Select pose log_softmax output and labels from output dictionary.

Parameters:

output (Dict[str, ignite.metrics.Metric]) – Engine output

Returns:

Logarithm of the pose class probabilities (log_softmax) and class label

Return type:

Tuple[torch.Tensor, torch.Tensor]

Notes

This function is used as output_transform in ignite.metrics.metric.Metric and allow to select pose results from the dictionary that the evaluator returns.

The output is not activated, i.e. the log_softmax output is returned unchanged

gninatorch.transforms.output_transform_select_pose(output: Dict[str, Tensor]) Tuple[Tensor, Tensor][source]

Select pose softmax output and labels from output dictionary.

Parameters:

output (Dict[str, ignite.metrics.Metric]) – Engine output

Returns:

Class probabilities and class labels

Return type:

Tuple[torch.Tensor, torch.Tensor]

Notes

This function is used as output_transform in ignite.metrics.metric.Metric and allow to select pose results from the dictionary that the evaluator returns.

The output is activated, i.e. the log_softmax output is transformed into softmax.