Implementation of the SimpleMKL solver. Java conversion of the original matlab code.
SimpleMKL Alain Rakotomamonjy, Francis Bach, Stephane Canu, Yves Grandvalet Journal of Machine Learning Research 9 (2008) 2491-2521
686970717273747576777879
System.out.println("Error parsing file "+args[1]); return; } //setting kernel DoubleGaussL2 kernel = new DoubleGaussL2(); kernel.setGamma(2.0); //setting SVM parameters LaSVM<double[]> svm = new LaSVM<double[]>(kernel); svm.setC(10); //C hyperparameter
9899100101102103104105106107108
// kernel type else if (args[i].equalsIgnoreCase("-k")) { i++; if (args[i].equalsIgnoreCase("gauss")) { kernel = new DoubleGaussL2(); } else { kernel = new DoubleLinear(); } } // algorithm
4647484950515253
public void setUp() throws Exception { GaussianGenerator g = new GaussianGenerator(10, 5.0f, 1.0); train = g.generateList(10); DoubleGaussL2 k = new DoubleGaussL2(1.0); svm = new LaSVM<double[]>(k); }
5051525354555657585960
MultiClassGaussianGenerator mcgg = new MultiClassGaussianGenerator(4); mcgg.setP(10); mcgg.setSigma(1); train = mcgg.generateList(5); DoubleGaussL2 k = new DoubleGaussL2(); k.setGamma(0.5); LaSVM<double[]> svm = new LaSVM<double[]>(k); svm.setC(10); multisvm = new OneAgainstAll<double[]>(svm); }
4546474849505152
5758596061626364656667
* Test method for * {@link fr.lip6.jkernelmachines.density.SMODensity#train(java.util.List)}. */ @Test public final void testTrainListOfT() { DoubleGaussL2 k = new DoubleGaussL2(); SMODensity<double[]> de = new SMODensity<double[]>(k); de.setC(1.); de.train(train); for (double[] x : train) {
464748495051525354
public void setUp() throws Exception { GaussianGenerator g = new GaussianGenerator(10, 5.0f, 0.1); train = g.generateList(50); DoubleGaussL2 k = new DoubleGaussL2(1.0); svm = new LaSVM<double[]>(k); svm.setC(1.0); }
5960616263646566676869
* Test method for * {@link fr.lip6.jkernelmachines.density.SMODensity#train(java.util.List)}. */ @Test public final void testTrainListOfT() { DoubleGaussL2 k = new DoubleGaussL2(); SimpleMKLDensity<double[]> de = new SimpleMKLDensity<double[]>(); for(int i = 0 ; i < 2 ; i++) { de.addKernel(new IndexDoubleGaussL2(i)); } de.addKernel(k);
54555657585960616263
int dim = 128; GaussianGenerator gen = new GaussianGenerator(dim, 0, 1.0); list = gen.generateList(dim); k = new DoubleGaussL2(2.0); pca = new KernelPCA<double[]>(k); pca.train(list); }
474849505152535455