@Test
public void testPredict() {

    Vector weights = new DenseVector(new double[]{2.0, 3.0});
    LinearRegressionModel mdl = new LinearRegressionModel(weights, 1.0);
    assertTrue(!mdl.toString().isEmpty());
    assertTrue(!mdl.toString(true).isEmpty());
    assertTrue(!mdl.toString(false).isEmpty());
    Vector observation = new DenseVector(new double[]{1.0, 1.0});
    TestUtils.assertEquals(1.0 + 2.0 * 1.0 + 3.0 * 1.0, mdl.predict(observation), PRECISION);
    observation = new DenseVector(new double[]{2.0, 1.0});
    TestUtils.assertEquals(1.0 + 2.0 * 2.0 + 3.0 * 1.0, mdl.predict(observation), PRECISION);
    observation = new DenseVector(new double[]{1.0, 2.0});
    TestUtils.assertEquals(1.0 + 2.0 * 1.0 + 3.0 * 2.0, mdl.predict(observation), PRECISION);
    observation = new DenseVector(new double[]{-2.0, 1.0});
    TestUtils.assertEquals(1.0 - 2.0 * 2.0 + 3.0 * 1.0, mdl.predict(observation), PRECISION);
    observation = new DenseVector(new double[]{1.0, -2.0});
    TestUtils.assertEquals(1.0 + 2.0 * 1.0 - 3.0 * 2.0, mdl.predict(observation), PRECISION);
}