Thread: Q9, SVM vs PLA
View Single Post
  #16  
Old 05-23-2013, 09:23 AM
jlaurentum jlaurentum is offline
Member
 
Join Date: Apr 2013
Location: Venezuela
Posts: 41
Default Re: Q9, SVM vs PLA

Hello Christine:

I tried your code using the sweep function (which is totally mysterious to me and so like Elroch, I'd like to ask how you arrived at this function). I got the following error message (using r in spanish):

Code:
Error en sweep(x[, 2:3], MARGIN = 1, y, "*") : 
  subíndice fuera de  los límites
Ejecución interrumpida
In other words, subindex out of bounds.
So I tried my version of the H matrix:

Code:
H <-  kernelPol(vanilladot(),x,,y)
where x and y are the input matrix and output vector respectively. This is what I got:

Code:
Error en solve.default(AP, c(c.x, c.y)) : 
  sistema es computacionalmente singular: número de condición recíproco = 1.92544e-16
Calls: ipop -> ipop -> solve -> solve.default
Ejecución interrumpida
Hmmm... So a computationally singular matrix. I played around with the u vector of upper constraints like so:

Code:
u <- matrix(rep(1e3,N))
And it somehow went through (sometimes). However, apart from the fact that the results were complete nonsense the in sample error was invariably non zero. As Elroch remarked, I also had the intuitive realization that if the upper matrix was not high enough, some alpha values were always reaching the upper bound (in this case 1e3=1000), and that did not seem right....

Ahh... quadratic programming and its mysteries!

That's why I gave up on ipop altogether and decided to use ksvm:

Code:
	x <- as.matrix(training_data[,2:3]) #pull out x_0
	y <- as.matrix(training_data[,4])
	svmmodel <- ksvm(x,y,kernel="vanilladot",C=100,type="C-svc")
But my answers obtained in Q9 and Q10 were not correct.
Reply With Quote