LFD Book Forum  

Go Back   LFD Book Forum > Course Discussions > Online LFD course > The Final

Reply
 
Thread Tools Display Modes
  #1  
Old 09-14-2012, 11:23 AM
MLearning MLearning is offline
Senior Member
 
Join Date: Jul 2012
Posts: 56
Default Question 13 - RBF with hard mrgin unable to accurately classifiy

I am having difficulty getting SVM with RBF to accurately classify a linearly separable data. I included herein a piece of my code.

N = 100; gamma = 1.5;

X = 2*rand(2,N)-1; %Training data
fx=sign(X(2,-X(1, + 0.25*sin(pi*X(1,));

%Generate Kx(xn,xm)
for n=1:N
for m=1:N
Kx(n,m)=exp(-gamma*(norm(X(:,n)-X(:,m))).^2);
end
end

Q=(fx*fx').*Kx; %Q Matrix
... %other input parameters are similarly defined

alpha0=zeros(N,1)% This initialization has no effect

alphan = quadprog(Q,q,[],[],Aeq,beq,lb,ub,alpha0,optimset('maxiter',10000,'la rgescale','off'));

wsvm=((alphan.*fx')'*Kx')';

The problem is that all values of alphan are very small (e.g., max(alphan) = 0.0072 in one of the runs). Due to this, gx is either always equal to 1 -1.

Can anyone point out where the error lies in the above piece of code? I really appreciate it.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:12 AM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
The contents of this forum are to be used ONLY by readers of the Learning From Data book by Yaser S. Abu-Mostafa, Malik Magdon-Ismail, and Hsuan-Tien Lin, and participants in the Learning From Data MOOC by Yaser S. Abu-Mostafa. No part of these contents is to be communicated or made accessible to ANY other person or entity.