graphinvent/Workflow.py
def compute_loss_component(self, scores : torch.Tensor,
                               agent_loglikelihoods : torch.Tensor,
                               prior_loglikelihoods : torch.Tensor,
                               uniqueness : torch.Tensor) -> \
                               torch.Tensor:
        """
        Computes the contributions to the loss from the log-likelihoods/scores
        of the two input models.

        Args:
        ----
            scores (torch.Tensor)               : Scores for sampled molecules based
                                                  on the user-defined scoring function.
            agent_loglikelihoods (torch.Tensor) : Log-likelihoods of generating
                                                  the sampled structures using the
                                                  agent model.
            prior_loglikelihoods (torch.Tensor) : Log-likelihoods of generating
                                                  the sampled structures using the
                                                  prior model.
            uniqueness (torch.Tensor)           : Vector specifying the uniqueness
                                                  of each sampled structure (1 -->
                                                  unique, 0 --> duplicate).

        Returns:
        -------
            torch.Tensor: The loss contributions from the input log-likelihoods.
        """
        augmented_prior_loglikelihoods = (
            prior_loglikelihoods + self.constants.sigma * scores
        )

        difference = agent_loglikelihoods - augmented_prior_loglikelihoods
        loss       = difference * difference
        mask       = (uniqueness != 0).int()
        loss       = loss * mask

        return loss

        Computes the contributions to the loss from the log-likelihoods/scores
        of the two input models.

        Args:
        ----
            scores (torch.Tensor)               : Scores for sampled molecules based
                                                  on the user-defined scoring function.
            agent_loglikelihoods (torch.Tensor) : Log-likelihoods of generating
                                                  the sampled structures using the
                                                  agent model.
            prior_loglikelihoods (torch.Tensor) : Log-likelihoods of generating
                                                  the sampled structures using the
                                                  prior model.
            uniqueness (torch.Tensor)           : Vector specifying the uniqueness
                                                  of each sampled structure (1 -->
                                                  unique, 0 --> duplicate).

        Returns:
        -------
            torch.Tensor: The loss contributions from the input log-likelihoods.
        
Computes the contributions to the loss from the log-likelihoods/scores
of the two input models.
Computes the contributions to the loss from the log - likelihoods / scores of the two input models .
def compute_loss_component(self, scores : torch.Tensor,
                               agent_loglikelihoods : torch.Tensor,
                               prior_loglikelihoods : torch.Tensor,
                               uniqueness : torch.Tensor) -> \
                               torch.Tensor:
        augmented_prior_loglikelihoods = (
            prior_loglikelihoods + self.constants.sigma * scores
        )
        difference = agent_loglikelihoods - augmented_prior_loglikelihoods
        loss       = difference * difference
        mask       = (uniqueness != 0).int()
        loss       = loss * mask
        return loss
def compute_loss_component ( self , scores : torch . Tensor , agent_loglikelihoods : torch . Tensor , prior_loglikelihoods : torch . Tensor , uniqueness : torch . Tensor ) -> torch . Tensor : augmented_prior_loglikelihoods = ( prior_loglikelihoods + self . constants . sigma * scores ) difference = agent_loglikelihoods - augmented_prior_loglikelihoods loss = difference * difference mask = ( uniqueness != 0 ) . int ( ) loss = loss * mask return loss
Computes the contributions to the loss from the log-likelihoods/scores
of the two input models.
Computes the contributions to the loss from the log - likelihoods / scores of the two input models .
"""
        Computes the contributions to the loss from the log-likelihoods/scores
        of the two input models.

        Args:
        ----
            scores (torch.Tensor)               : Scores for sampled molecules based
                                                  on the user-defined scoring function.
            agent_loglikelihoods (torch.Tensor) : Log-likelihoods of generating
                                                  the sampled structures using the
                                                  agent model.
            prior_loglikelihoods (torch.Tensor) : Log-likelihoods of generating
                                                  the sampled structures using the
                                                  prior model.
            uniqueness (torch.Tensor)           : Vector specifying the uniqueness
                                                  of each sampled structure (1 -->
                                                  unique, 0 --> duplicate).

        Returns:
        -------
            torch.Tensor: The loss contributions from the input log-likelihoods.
        """
The loss contributions from the input log-likelihoods.
The loss contributions from the input log - likelihoods .
torch.Tensor
self
scores
torch.Tensor
Scores for sampled molecules based
on the user-defined scoring function.
Scores for sampled molecules based on the user - defined scoring function .
agent_loglikelihoods
torch.Tensor
Log-likelihoods of generating
the sampled structures using the
agent model.
Log - likelihoods of generating the sampled structures using the agent model .
prior_loglikelihoods
torch.Tensor
Log-likelihoods of generating
the sampled structures using the
prior model.
Log - likelihoods of generating the sampled structures using the prior model .
uniqueness
torch.Tensor
Vector specifying the uniqueness
of each sampled structure (1 -->
unique, 0 --> duplicate).
Vector specifying the uniqueness of each sampled structure ( 1 -- > unique 0 -- > duplicate ) .