Challenge: Convex Optimization

Evaluate yourself on the concepts learned in this chapter via a coding exercise.

Problem statement

Suppose a new movie is released and you want to estimate the probability that a random viewer will like it. You assume that this probability follows a beta distribution with a fixed lower bound of 00 and an upper bound of 11. You also assume that the shape parameter of the beta distribution θ\theta is unknown, and you want to find its maximum likelihood estimate.

Mathematical formulation

You collect some data by asking nn viewers to rate the movie on a scale of 00 to 11, where 00 means they hated it and 11 means they loved it. You record their ratings as x1,x2,,xnx_1, x_2, …, x_n. Based on these ratings, you need to estimate the shape parameter θ\theta of the beta distribution.

The probability density function of the beta distribution with the shape parameter θ\theta is given as follows:

Get hands-on with 1400+ tech skills courses.