@@ -0,0 +1,1992 @@
+/**%0A    This file is part of JkernelMachines.%0A%0A    JkernelMachines is free software: you can redistribute it and/or modify%0A    it under the terms of the GNU General Public License as published by%0A    the Free Software Foundation, either version 3 of the License, or%0A    (at your option) any later version.%0A%0A    JkernelMachines is distributed in the hope that it will be useful,%0A    but WITHOUT ANY WARRANTY; without even the implied warranty of%0A    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A    GNU General Public License for more details.%0A%0A    You should have received a copy of the GNU General Public License%0A    along with JkernelMachines.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A%0A    Copyright David Picard - 2013%0A%0A*/%0Apackage fr.lip6.jkernelmachines.test.classifier;%0A%0Aimport java.util.List;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport fr.lip6.jkernelmachines.classifier.LaSVM;%0Aimport fr.lip6.jkernelmachines.classifier.multiclass.OneAgainstAll;%0Aimport fr.lip6.jkernelmachines.kernel.typed.DoubleGaussL2;%0Aimport fr.lip6.jkernelmachines.type.TrainingSample;%0Aimport fr.lip6.jkernelmachines.util.generators.MultiClassGaussianGenerator;%0A%0A/**%0A * @author picard%0A *%0A */%0Apublic class MulticlassLaSVMTest %7B%0A%09%0A%09List%3CTrainingSample%3Cdouble%5B%5D%3E%3E train;%0A%09OneAgainstAll%3Cdouble%5B%5D%3E multisvm;%0A%09%0A%09/**%0A%09 * @throws java.lang.Exception%0A%09 */%0A%09@Before%0A%09public void setUp() throws Exception %7B%0A%09%09MultiClassGaussianGenerator mcgg = new MultiClassGaussianGenerator(4);%0A%09%09mcgg.setP(10);%0A%09%09mcgg.setSigma(1);%0A%09%09train = mcgg.generateList(5);%0A%09%09%0A%09%09DoubleGaussL2 k = new DoubleGaussL2();%0A%09%09k.setGamma(0.5);%0A%09%09LaSVM%3Cdouble%5B%5D%3E svm = new LaSVM%3Cdouble%5B%5D%3E(k);%0A%09%09svm.setC(10);%0A%09%09multisvm = new OneAgainstAll%3Cdouble%5B%5D%3E(svm);%0A%09%7D%0A%0A%09@Test%0A%09public final void testTrainListOfTrainingSampleOfT() %7B%0A%09%09multisvm.train(train);%0A%09%09for(TrainingSample%3Cdouble%5B%5D%3E t : train) %7B%0A%09%09%09double v = multisvm.valueOf(t.sample);%0A%09%09%09assertEquals(v, t.label, 1e-15);%0A%09%09%7D%0A%09%7D%0A%7D%0A

add junit test for multiclass