<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def conditional_expected_average_profit(self, frequency=None, monetary_value=None):
 """ Conditional expectation of the average profit. This method computes the conditional expectation of the average profit per transaction for a group of one or more customers. Parameters frequency: array_like, optional a vector containing the customers' frequencies. Defaults to the whole set of frequencies used for fitting the model. monetary_value: array_like, optional a vector containing the customers' monetary values. Defaults to the whole set of monetary values used for fitting the model. Returns ------- array_like: The conditional expectation of the average profit per transaction """

        if monetary_value is None:
            monetary_value = self.data["monetary_value"]
        if frequency is None:
            frequency = self.data["frequency"]
        p, q, v = self._unload_params("p", "q", "v")

        # The expected average profit is a weighted average of individual
        # monetary value and the population mean.
        individual_weight = p * frequency / (p * frequency + q - 1)
        population_mean = v * p / (q - 1)
        return (1 - individual_weight) * population_mean + individual_weight * monetary_value