mindsponge.metrics.compute_renamed_ground_truth

View Source On Gitee
mindsponge.metrics.compute_renamed_ground_truth(atom14_gt_positions, atom14_alt_gt_positions, atom14_atom_is_ambiguous, atom14_gt_exists, atom14_pred_positions, atom14_alt_gt_exists)[source]

Find optimal renaming of ground truth based on the predicted positions.

Jumper et al. (2021) Suppl. Alg. 26 “renameSymmetricGroundTruthAtoms”

This renamed ground truth is then used for all losses, such that each loss moves the atoms in the same direction. Shape (N).

Parameters
  • atom14_gt_positions (Tensor) – Ground truth positions. shape \((N_{res}, 14, 3)\) .

  • atom14_alt_gt_positions (Tensor) – Ground truth positions with renaming swaps. shape \((N_{res}, 14, 3)\) .

  • atom14_atom_is_ambiguous (Tensor) – 1.0 for atoms that are affected by renaming swaps. shape \((N_{res}, 14)\) .

  • atom14_gt_exists (Tensor) – Mask for which atoms exist in ground truth. shape \((N_{res}, 14)\) .

  • atom14_pred_positions (Tensor) – Array of atom positions in global frame with shape \((N_{res}, 14, 3)\) .

  • atom14_alt_gt_exists (Tensor) – Mask for which atoms exist in ground truth after renaming. shape \((N_{res}, 14)\) .

Returns

  • alt_naming_is_better (Tensor) - Array with 1.0 where alternative swap is better. shape \((N_{res}, )\) .

  • renamed_atom14_gt_positions (Tensor) - Array of optimal ground truth positions after renaming swaps are performed. shape \((N_{res}, 14, 3)\) .

  • renamed_atom14_gt_exists (Tensor) - Mask after renaming swap is performed. shape \((N_{res}, 14)\) .

Symbol:

\(N_{res}\), number of amino acids.

Supported Platforms:

Ascend GPU

Examples

>>> import mindspore as ms
>>> from mindspore import Tensor
>>> import numpy as np
>>> from mindsponge.metrics import compute_renamed_ground_truth
>>> atom14_gt_positions = Tensor(np.random.random(size=(50, 14, 3)), ms.float32)
>>> atom14_alt_gt_positions = Tensor(np.random.random(size=(50, 14, 3)), ms.float32)
>>> atom14_atom_is_ambiguous = Tensor(np.random.random(size=(50, 14)), ms.float32)
>>> atom14_gt_exists = Tensor(np.random.random(size=(50, 14)), ms.float32)
>>> atom14_pred_positions = Tensor(np.random.random(size=(50, 14, 3)), ms.float32)
>>> atom14_alt_gt_exists = Tensor(np.random.random(size=(50, 14)), ms.float32)
>>> alt_naming_is_better, renamed_atom14_gt_positions, renamed_atom14_gt_exists =         ...     compute_renamed_ground_truth(atom14_gt_positions, atom14_alt_gt_positions, atom14_atom_is_ambiguous,
...                                  atom14_gt_exists, atom14_pred_positions, atom14_alt_gt_exists)
>>> print(alt_naming_is_better.shape, renamed_atom14_gt_positions.shape, renamed_atom14_gt_exists.shape)
(50,) (50, 14, 3) (50, 14)