I want to design something. In the process of the design I face a variable that is random and unknown to me. Using machine learning methods (e.g. Bayesian learning) I managed to find the probability density function (pdf) of this variable. Now I have a general question. What can I do with this pdf and what usually people do with pdfs. If I want to use only expectation of this random variable I did not need to go into this trouble finding PDF. Can you give me some examples of application of PDF in machine learning.

If I have statistical model for any phenomena I only know the probabilities but I do not know exactly what will happen. So how can that help me? Can you give me some examples?

  • $\begingroup$ If you have the pdf you can calculate the expectation if it exists by integrating x f(x) dx over the range of value for x with f as the pdf. But how did you get the density in the first place? $\endgroup$ Jun 4, 2017 at 14:32
  • $\begingroup$ There are various methods for learning PDFs. We can approximate them using sample data. Statistical machine learning is about that. But if I only wanted the mean, I do not need to find the PDF. I can have methods to approximate the mean using some sample data. $\endgroup$
    – user23047
    Jun 4, 2017 at 15:22

1 Answer 1


Consider the situation of an insurance company attempting to maximize its profits.

When a customer's contract comes up for renewal, the company has the option of offering them a new price. After receiving the new offer, the customer decides to either accept the new price, and purchase a contract renewal, or reject, and find someone else to insure them.

The company, after changing many customer's prices over much time, finds that there is a simple relationship between how much a customer's price has been changed, and the probability of them staying; though they can, of course, never say definitely whether the customer will or will not leave.

But, having this probability is sufficient for the company to calculate the expected profit for a customer at a given price

$$ E[\text{profit}] = (\text{price} - \text{cost}) \times P(\text{stay} \mid \text{price}) $$

If the price is too low, the customer will almost definitely stay, but the company will not cover it's costs. If the price is too high, the customer will almost certainly leave, and the company will get nothing. Somewhere in the middle there is a sweet spot, and the expected profit is maximized.

If I think of this as applying to every customer in my business, my total profit would be

$$ E[\text{total profit}] = \sum_i (\text{price}_i - \text{cost}_i) \times P(\text{stay}_i \mid \text{price}_i) $$

If we make the small assumption that customers leave independently, it's now easy to evaluate the overall effect of various pricing strategies. I can answer questions like "what is the optimal pricing strategy under the constraint that I end up with the same number of customers as before", or "If legislation forces me to increase overall prices by 5%, what is the best way to distribute those prices", or "if legislation forces me to raise prices by 5% uniformly, what is the 95% worst case scenario in terms of how many customers leave"?

That's the kind of thing you can do when you know probabilities.


Not the answer you're looking for? Browse other questions tagged or ask your own question.