code: def conditional_probability_alive(self, frequency, recency, T):
          
          r, alpha, a, b = self._unload_params("r", "alpha", "a", "b")
  
          log_div = (r + frequency) * np.log((alpha + T) / (alpha + recency)) + np.log(
              a / (b + np.maximum(frequency, 1) - 1)
          )
          return np.atleast_1d(np.where(frequency == 0, 1.0, expit(-log_div)))
docs: Compute conditional probability alive.
  
          Compute the probability that a customer with history
          (frequency, recency, T) is currently alive.
  
          From http://www.brucehardie.com/notes/021/palive_for_BGNBD.pdf
  
          Parameters
          ----------
          frequency: array or scalar
              historical frequency of customer.
          recency: array or scalar
              historical recency of customer.
          T: array or scalar
              age of the customer.
  
          Returns
          -------
          array
              value representing a probability