original_docstring: 
          Evaluate performance (log probability and per residue perplexity) on
          train and test datasets.
  
          :param ~torch.utils.data.Dataset dataset: The training dataset.
          :param ~torch.utils.data.Dataset dataset: The testing dataset.
          :param bool jit: Whether to use a jit compiled ELBO.
          
docstring: Evaluate performance (log probability and per residue perplexity) on
  train and test datasets.
docstring_tokens: Evaluate performance ( log probability and per residue perplexity ) on train and test datasets .
code: def evaluate(self, dataset_train, dataset_test=None, jit=False):
          """
          Evaluate performance (log probability and per residue perplexity) on
          train and test datasets.
  
          :param ~torch.utils.data.Dataset dataset: The training dataset.
          :param ~torch.utils.data.Dataset dataset: The testing dataset.
          :param bool jit: Whether to use a jit compiled ELBO.
          """
          dataload_train = DataLoader(dataset_train, batch_size=1, shuffle=False)
          if dataset_test is not None:
              dataload_test = DataLoader(dataset_test, batch_size=1, shuffle=False)
          # Initialize guide.
          self.guide(None, None)
          if jit:
              elbo = JitTrace_ELBO(ignore_jit_warnings=True)
          else:
              elbo = Trace_ELBO()
          scheduler = MultiStepLR({"optimizer": Adam, "optim_args": {"lr": 0.01}})
          # Setup stochastic variational inference.
          svi = SVI(self.model, self.guide, scheduler, loss=elbo)
  
          # Compute elbo and perplexity.
          train_lp, train_perplex = self._evaluate_local_elbo(
              svi, dataload_train, len(dataset_train)
          )
          if dataset_test is not None:
              test_lp, test_perplex = self._evaluate_local_elbo(
                  svi, dataload_test, len(dataset_test)
              )
              return train_lp, test_lp, train_perplex, test_perplex
          else:
              return train_lp, None, train_perplex, None
code_tokens: def evaluate ( self , dataset_train , dataset_test = None , jit = False ) : dataload_train = DataLoader ( dataset_train , batch_size = 1 , shuffle = False ) if dataset_test is not None : dataload_test = DataLoader ( dataset_test , batch_size = 1 , shuffle = False ) self . guide ( None , None ) if jit : elbo = JitTrace_ELBO ( ignore_jit_warnings = True ) else : elbo = Trace_ELBO ( ) scheduler = MultiStepLR ( { "optimizer" : Adam , "optim_args" : { "lr" : 0.01 } } ) svi = SVI ( self . model , self . guide , scheduler , loss = elbo ) train_lp , train_perplex = self . _evaluate_local_elbo ( svi , dataload_train , len ( dataset_train ) ) if dataset_test is not None : test_lp , test_perplex = self . _evaluate_local_elbo ( svi , dataload_test , len ( dataset_test ) ) return train_lp , test_lp , train_perplex , test_perplex else : return train_lp , None , train_perplex , None
short_docstring: Evaluate performance (log probability and per residue perplexity) on
  train and test datasets.
short_docstring_tokens: Evaluate performance ( log probability and per residue perplexity ) on train and test datasets .
comment: """
          Evaluate performance (log probability and per residue perplexity) on
          train and test datasets.
  
          :param ~torch.utils.data.Dataset dataset: The training dataset.
          :param ~torch.utils.data.Dataset dataset: The testing dataset.
          :param bool jit: Whether to use a jit compiled ELBO.
          """$SEP$# Initialize guide.$SEP$# Setup stochastic variational inference.$SEP$# Compute elbo and perplexity.