The chart below show 30 examples in three classes—red, green, and blue. Each class has two inputs \(x_1\) and \(x_2\) that range between 0 and 100.

The Python program below finds polynomial logistic models for the classes. It uses gradient descent to find coefficients \(\theta_0^{(i)}, \theta_1^{(i)}, ... \theta_4^{(i)}\) for \(x_1\), \(x_2\), \(x_1^2\) and \(x_2^2\) (\(i = {1, 2, 3}\).)

Don’t forget to use pip install numpy to install the numpy library before running this.

The above program should run in a few minutes and then print out \(\theta\) values. For each of the classes, try entering its \(\theta\) values below. When you’ve entered all the values, you will see what the model function for that class looks like.

$$\theta_0$$
$$\theta_1$$
$$\theta_2$$
$$\theta_3$$
$$\theta_4$$