Question

I want to plot decision boundary for classification of iris data.Since the decision boundaries are hyper plans in 4D space, plotting the decision boundaries are not straightforward.

According to LIBSVM FAQ page we should do following to have w and b. Suppose the goal is to find the vector w of classes 1 vs 3.

coef = [m.sv_coef(1:3,2); m.sv_coef(25:42,1)];
SVs = [m.SVs(1:3,:); m.SVs(25:42,:)];
w = SVs'*coef;
b = -m.rho(2);

I want to plot boundary in 2D space by selecting just 2 dimensions of data. What should I do?

Était-ce utile?

La solution

Your code is true.You should try 2 dimension that can separate 2 class appropraitely.try 1 and 3.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top