code: def conditional_expected_number_of_purchases_up_to_time(self, t, frequency, recency, T):
          
          x = frequency
          r, alpha, a, b = self._unload_params("r", "alpha", "a", "b")
  
          hyp_term = hyp2f1(r + x, b + x + 1, a + b + x, t / (alpha + T + t))
          first_term = (a + b + x) / (a - 1)
          second_term = 1 - hyp_term * ((alpha + T) / (alpha + t + T)) ** (r + x)
          numerator = first_term * second_term
  
          denominator = 1 + (a / (b + x)) * ((alpha + T) / (alpha + recency)) ** (r + x)
  
          return numerator / denominator
docs: Conditional expected number of repeat purchases up to time t.
  
          Calculate the expected number of repeat purchases up to time t for a
          randomly choose individual from the population, given they have
          purchase history (frequency, recency, T)
          See Wagner, U. and Hoppe D. (2008).
  
          Parameters
          ----------
          t: array_like
              times to calculate the expectation for.
          frequency: array_like
              historical frequency of customer.
          recency: array_like
              historical recency of customer.
          T: array_like
              age of the customer.
  
          Returns
          -------
          array_like