code: def plot_probability_alive_matrix(
      model,
      max_frequency=None,
      max_recency=None,
      title="Probability Customer is Alive,\nby Frequency and Recency of a Customer",
      xlabel="Customer's Historical Frequency",
      ylabel="Customer's Recency",
      **kwargs
  ):
      
      from matplotlib import pyplot as plt
  
      z = model.conditional_probability_alive_matrix(max_frequency, max_recency)
  
      interpolation = kwargs.pop("interpolation", "none")
  
      ax = plt.subplot(111)
      pcm = ax.imshow(z, interpolation=interpolation, **kwargs)
      plt.xlabel(xlabel)
      plt.ylabel(ylabel)
      plt.title(title)
  
      # turn matrix into square
      forceAspect(ax)
  
      # plot colorbar beside matrix
      plt.colorbar(pcm, ax=ax)
  
      return ax
docs: Plot probability alive matrix as heatmap.
  
      Plot a figure of the probability a customer is alive based on their
      frequency and recency.
  
      Parameters
      ----------
      model: lifetimes model
          A fitted lifetimes model.
      max_frequency: int, optional
          The maximum frequency to plot. Default is max observed frequency.
      max_recency: int, optional
          The maximum recency to plot. This also determines the age of the customer.
          Default to max observed age.
      title: str, optional
          Figure title
      xlabel: str, optional
          Figure xlabel
      ylabel: str, optional
          Figure ylabel
      kwargs
          Passed into the matplotlib.imshow command.
  
      Returns
      -------
      axes: matplotlib.AxesSubplot