/** * Test method for {@link net.jkernelmachines.classifier.DoublePegasosSVM#train(java.util.List)}. */ @Test public final void testTrainListOfTrainingSampleOfdouble() { svm.train(train); for (TrainingSample<double[]> t : train) { double v = t.label * svm.valueOf(t.sample); assertTrue(v > 0); } }
/** * Test method for {@link net.jkernelmachines.classifier.DoublePegasosSVM#train(java.util.List)}. */ @Test public final void testOnlineTrainTrainingSampleStreamOfdouble() { svm.onlineTrain(new ListSampleStream<double[]>(train)); for (TrainingSample<double[]> t : train) { double v = t.label * svm.valueOf(t.sample); assertTrue(v > 0); } }
/** * Test method for {@link * net.jkernelmachines.classifier.DoublePegasosSVM#train(fr.lip6.jkernelmachines.TrainingSample)}. */ @Test public final void testTrainOfTrainingSampleOfdouble() { svm = new DoublePegasosSVM(); for (TrainingSample<double[]> t : train) { svm.train(t); } for (TrainingSample<double[]> t : train) { double v = t.label * svm.valueOf(t.sample); assertTrue(v > 0); } }
/** Test method for {@link net.jkernelmachines.classifier.DoublePegasosSVM#setC(double)}. */ @Test public final void testSetC() { svm.setC(1.0); assertEquals(1.0, svm.getC(), 1e-15); }
/** Test method for {@link net.jkernelmachines.classifier.DoublePegasosSVM#setBias(boolean)}. */ @Test public final void testSetBias() { svm.setBias(true); assertTrue(svm.isBias()); }
/** Test method for {@link net.jkernelmachines.classifier.DoublePegasosSVM#setLambda(double)}. */ @Test public final void testSetLambda() { svm.setLambda(1e-3); assertEquals(1e-3, svm.getLambda(), 1e-15); }
/** Test method for {@link net.jkernelmachines.classifier.DoublePegasosSVM#setK(int)}. */ @Test public final void testSetK() { svm.setK(10); assertEquals(10, svm.getK()); }