HW2 5.3 plot decision boundary

42 views
Skip to first unread message

fred king

unread,
Feb 19, 2013, 12:39:53 PM2/19/13
to 10-701-spri...@googlegroups.com
Hi all,
Does anyone can tell how to draw decision boundary? it seems the meshgrid and contourf can only deal with regularly mesh . Many thanks.

Krikamol Muandet

unread,
Feb 19, 2013, 12:46:36 PM2/19/13
to fred king, 10-701-spri...@googlegroups.com
Hi,

I assume you are using Matlab. In that case, you can try the ezplot function. Here is an example.

svm_fun = @(x,y) w'*[x; y]+b;
ezplot(svm_fun);

where w and b is the parameter of SVM.

Krik


On 19 February 2013 18:39, fred king <jinyi...@gmail.com> wrote:
Hi all,
Does anyone can tell how to draw decision boundary? it seems the meshgrid and contourf can only deal with regularly mesh . Many thanks.

--
http://alex.smola.org/teaching/cmu2013-10-701 (course website)
http://www.youtube.com/playlist?list=PLZSO_6-bSqHQmMKwWVvYwKreGu4b4kMU9 (YouTube playlist)
---
You received this message because you are subscribed to the Google Groups "10-701 Spring 2013 CMU" group.
To unsubscribe from this group and stop receiving emails from it, send an email to 10-701-spring-201...@googlegroups.com.
To post to this group, send email to 10-701-spri...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Krikamol Muandet
PhD Student                                                   
Max Planck Institute for Intelligent Systems            
Spemannstrasse 38, 72076 Tübingen, Germany      
Telephone: +49-(0)7071 601 554
http://www.kyb.mpg.de/~krikamol

fred king

unread,
Feb 19, 2013, 1:03:26 PM2/19/13
to 10-701-spri...@googlegroups.com, fred king
Hi Krik,
It seems work, but sine w and b is not output, do you mean we should plot them inside the svm_primal_classify? Another question is that in dual problem, i.e. RBF, I can not obtain w in this case, I use \sum \alpha_i y_i k(x_i,x) + b  , then how do I plot using ezplot?

在 2013年2月19日星期二UTC-5下午12时46分36秒,Krik写道:
Hi,

I assume you are using Matlab. In that case, you can try the ezplot function. Here is an example.

svm_fun = @(x,y) w'*[x; y]+b;
ezplot(svm_fun);

where w and b is the parameter of SVM.

Krik
On 19 February 2013 18:39, fred king <jinyi...@gmail.com> wrote:
Hi all,
Does anyone can tell how to draw decision boundary? it seems the meshgrid and contourf can only deal with regularly mesh . Many thanks.

--
http://alex.smola.org/teaching/cmu2013-10-701 (course website)
http://www.youtube.com/playlist?list=PLZSO_6-bSqHQmMKwWVvYwKreGu4b4kMU9 (YouTube playlist)
---
You received this message because you are subscribed to the Google Groups "10-701 Spring 2013 CMU" group.
To unsubscribe from this group and stop receiving emails from it, send an email to 10-701-spring-2013-cmu+unsub...@googlegroups.com.

To post to this group, send email to 10-701-spri...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Krikamol Muandet

unread,
Feb 19, 2013, 1:40:22 PM2/19/13
to fred king, 10-701-spri...@googlegroups.com
Hi Fred,

You can use the property that w can be written as a linear combination of feature maps. That is,

svm_fun = @(x,y) \sum \alpha_i y_i k(x_i,x) + b;

if you don't know w and b, but be able to compute the classification, i.e., either +1 or -1, then you may use this value directly.

Krik


To unsubscribe from this group and stop receiving emails from it, send an email to 10-701-spring-201...@googlegroups.com.

To post to this group, send email to 10-701-spri...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages