A simple way to plot a nonlinear classification hypothesis, which is actually the way used for all the figures in the book, is the brute force approach. Construct a grid of points, for example:
x1={0,0.01,0.02,...,1}
x2={0,0.01,0.02,...,1}
So every pair (x1,x2) from each set is a point in 2 dimensions. Now, for every such pair, evaluate the hypothesis h(x1,x2) and plot a red point if h=-1 and a blue point if h=+1. Note h can be any hypothesis, 3rd order polynomial, etc.
It is slow but it works.
Quote:
Originally Posted by rpistu
For part e, when plotting the data and the final hypothesis learnt from a 3rd order polynomial feature transform, the shape of the nonlinear hypothesis is almost like a line. Is that true? Actually, I didn't find an effective way to plot the nonlinear hypothesis.
|