lauerfab / MLweb

Machine learning and scientific computing (linear algebra, statistics, optimization) javascript libraries, with an online lab.
http://mlweb.loria.fr
GNU General Public License v2.0
85 stars 22 forks source link

msvm doesn't work with 2 classes #2

Closed m0ose closed 7 years ago

m0ose commented 7 years ago

MSVM doesn't work with just 2 classes. I apologise if this is an intended feature.

It can be reproduced by adding "Y[80:120] = 2" after the 3rd line of the example. I was using the LaloLab interface.

data = loadURL("examples/iris.train")
X = data[:, 0:4]
Y = data[:,4]
Y[80:120] = 2
data = loadURL("examples/iris.test")
Xtest = data[:, 0:4]
Ytest = data[:,4]
msvm = new Classifier(MSVM, {MSVMtype: "WW", kernel: "rbf", kernelpar: 1} )
msvm.train(X, Y)
plot( msvm.predict( Xtest ) )
RecRate = msvm.test( Xtest, Ytest )
lauerfab commented 7 years ago

Since M-SVMs are "multi-class" SVMs dedicated to problems with more than two categories, this is a kind of "intended" feature. However, the error message telling the user about this was badly implemented and could not be printed. This is now fixed. Thank you for your interest and bug report.

m0ose commented 7 years ago

Nice. Thank you. This is a nice library. Quick question. I came across a page describing one-class SVMs at https://msdn.microsoft.com/en-us/library/azure/dn913103.aspx. Do you know if that a special kind of svm or can one configure a binary svm to do the same thing?