code: def conditional_expected_number_of_purchases_up_to_time(self, m_periods_in_future, frequency, recency, n_periods):
          r
          x = frequency
          tx = recency
          n = n_periods
  
          params = self._unload_params("alpha", "beta", "gamma", "delta")
          alpha, beta, gamma, delta = params
  
          p1 = 1 / exp(self._loglikelihood(params, x, tx, n))
          p2 = exp(betaln(alpha + x + 1, beta + n - x) - betaln(alpha, beta))
          p3 = delta / (gamma - 1) * exp(gammaln(gamma + delta) - gammaln(1 + delta))
          p4 = exp(gammaln(1 + delta + n) - gammaln(gamma + delta + n))
          p5 = exp(gammaln(1 + delta + n + m_periods_in_future) - gammaln(gamma + delta + n + m_periods_in_future))
  
          return p1 * p2 * p3 * (p4 - p5)
docs: r"""
          Conditional expected purchases in future time period.
  
          The  expected  number  of  future  transactions across the next m_periods_in_future
          transaction opportunities by a customer with purchase history
          (x, tx, n).
  
          .. math:: E(X(n_{periods}, n_{periods}+m_{periods_in_future})| \alpha, \beta, \gamma, \delta, frequency, recency, n_{periods})
  
          See (13) in Fader & Hardie 2010.
  
          Parameters
          ----------
          t: array_like
              time n_periods (n+t)
  
          Returns
          -------
          array_like
              predicted transactions