LinearModel { public void timesDelta(int index, double delta) { double element = this.hyperplane.get(index); element *= delta; this.hyperplane.setQuick(index, element); } LinearModel(Vector hyperplane, double displacement, double threshold);  LinearModel(Vector hyperplane); boolean classify(Vector dataPoint); void addDelta(Vector delta); @Override String toString(); void shiftBias(double factor); void timesDelta(int index, double delta);  }
@Test public void testTimesDelta() { double[] values = {-1.0, -1.0, -1.0, -1.0, -1.0}; this.model.addDelta(new DenseVector(values)); double[] dotval = {-1.0, -1.0, -1.0, -1.0, -1.0}; for (int i = 0; i < dotval.length; i++) { this.model.timesDelta(i, dotval[i]); } double[] valuesFalse = {1.0, 0.0, 1.0, 0.0, 1.0}; Vector dataPointFalse = new DenseVector(valuesFalse); assertTrue(this.model.classify(dataPointFalse)); double[] valuesTrue = {0.0, 1.0, 0.0, 1.0, 0.0}; Vector dataPointTrue = new DenseVector(valuesTrue); assertFalse(this.model.classify(dataPointTrue)); }