class_docstr: Representation of a response term in a PyMC model.
  
  Parameters
  ----------
  term : bambi.terms.ResponseTerm
      The response term as represented in Bambi.
  family : bambi.famlies.Family
      The model family.
class_docstr_tok: ["Representation","of","a","response","term","in","a","PyMC","model",".","Parameters","--","--","--","--","--","term",":","bambi.terms.ResponseTerm","The","response","term","as","represented","in","Bambi",".","family",":","bambi.famlies.Family","The","model","family","."]
code: def build_response_distribution(self, kwargs, pymc_backend):
      # Get likelihood distribution
      distribution = get_distribution_from_likelihood(
          self.family.likelihood
      )
  
      # Families can implement specific transformations of parameters that are passed to the
      # likelihood function
      if hasattr(self.family, "transform_backend_kwargs"):
          kwargs = self.family.transform_backend_kwargs(kwargs)
  
      kwargs = self.robustify_dims(pymc_backend, kwargs)
  
      # Handle censoring
      if self.term.is_censored:
          dims = kwargs.pop("dims", None)
          data_matrix = kwargs.pop("observed")
  
          # Get values of the response variable
          observed = np.squeeze(data_matrix[:, 0])
  
          # Get censoring codes
          censoring_code = np.squeeze(data_matrix[:, 1])
  
          is_left_censored = censoring_code == -1
          is_right_censored = censoring_code == 1
  
          lower = np.where(is_left_censored, observed, -np.inf)
          upper = np.where(is_right_censored, observed, np.inf)
          stateless_dist = distribution.dist(**kwargs)
          dist_rv = pm.Censored(
              self.name,
              stateless_dist,
              lower=lower,
              upper=upper,
              observed=observed,
              dims=dims,
          )
  
      # Handle truncation
      elif self.term.is_truncated:
          dims = kwargs.pop("dims", None)
          data_matrix = kwargs.pop("observed")
  
          # Get values of the response variable
          observed = np.squeeze(data_matrix[:, 0])
  
          # Get truncation values
          lower = np.squeeze(data_matrix[:, 1])
          upper = np.squeeze(data_matrix[:, 2])
  
          # Handle 'None' and scalars appropriately
          if np.all(lower == -np.inf):
              lower = None
          elif np.all(lower == lower[0]):
              lower = lower[0]
  
          if np.all(upper == np.inf):
              upper = None
          elif np.all(upper == upper[0]):
              upper = upper[0]
  
          stateless_dist = distribution.dist(**kwargs)
          dist_rv = pm.Truncated(
              self.name,
              stateless_dist,
              lower=lower,
              upper=upper,
              observed=observed,
              dims=dims,
          )
  
      # Handle constrained responses (through truncated distributions)
      elif self.term.is_constrained:
          dims = kwargs.pop("dims", None)
          data_matrix = kwargs.pop("observed")
  
          # Get values of the response variable
          observed = np.squeeze(data_matrix[:, 0])
  
          # Get truncation values
          lower = np.squeeze(data_matrix[:, 1])
          upper = np.squeeze(data_matrix[:, 2])
  
          # Handle 'None' and scalars appropriately
          if np.all(lower == -np.inf):
              lower = None
          elif np.all(lower == lower[0]):
              lower = lower[0]
  
          if np.all(upper == np.inf):
              upper = None
          elif np.all(upper == upper[0]):
              upper = upper[0]
  
          stateless_dist = distribution.dist(**kwargs)
          dist_rv = pm.Truncated(
              self.name,
              stateless_dist,
              lower=lower,
              upper=upper,
              observed=observed,
              dims=dims,
          )
  
      # Handle weighted responses
      elif self.term.is_weighted:
          dims = kwargs.pop("dims", None)
          data_matrix = kwargs.pop("observed")
  
          # Get values of the response variable
          observed = np.squeeze(data_matrix[:, 0])
  
          # Get weights
          weights = np.squeeze(data_matrix[:, 1])
  
          # Get a weighted version of the response distribution
          weighted_dist = make_weighted_distribution(distribution)
          dist_rv = weighted_dist(
              self.name, weights, **kwargs, observed=observed, dims=dims
          )
      # All of the other response kinds are "not special" and thus are handled the same way
      else:
          dist_rv = distribution(self.name, **kwargs)
  
      return dist_rv
  
imports: import inspect
  import numpy
  import pymc
  import pytensor.tensor
  from bambi.backend.utils import get_distribution_from_likelihood, get_distribution_from_prior, get_linkinv, has_hyperprior, make_weighted_distribution, GP_KERNELS
  from bambi.families.multivariate import MultivariateFamily, Multinomial, DirichletMultinomial
  from bambi.families.univariate import Categorical
  from bambi.priors import Prior
  from bambi.utils import get_aliased_name
label_desc: Use image node_id 3 for calling the ResponseTerm obj's underlying member method code with example usage: obj.build_response_distribution(kwargs, pymc_backend) and returns: dist_rv