@@ -0,0 +1,1745 @@
+package de.jungblut.regression;%0A%0Aimport java.nio.charset.Charset;%0Aimport java.nio.file.Files;%0Aimport java.nio.file.Paths;%0Aimport java.util.List;%0A%0Aimport junit.framework.TestCase;%0A%0Aimport org.junit.Test;%0A%0Aimport de.jungblut.math.DoubleMatrix;%0Aimport de.jungblut.math.DoubleVector;%0Aimport de.jungblut.math.MathUtils;%0Aimport de.jungblut.math.dense.DenseDoubleMatrix;%0Aimport de.jungblut.math.dense.DenseDoubleVector;%0Aimport de.jungblut.math.minimize.Fmincg;%0Aimport de.jungblut.math.minimize.GradientDescent;%0Aimport de.jungblut.math.tuple.Tuple3;%0A%0Apublic class RegressionCostFunctionTest extends TestCase %7B%0A%0A  @Test%0A  public void testCostFunctionFminCG() throws Exception %7B%0A    List%3CString%3E lines = Files.readAllLines(%0A        Paths.get(%22files/logreg/ex1data2.txt%22), Charset.defaultCharset());%0A%0A    DoubleMatrix features = new DenseDoubleMatrix(lines.size(), 2);%0A    DenseDoubleVector outcome = new DenseDoubleVector(lines.size());%0A    for (int i = 0; i %3C lines.size(); i++) %7B%0A      String%5B%5D line = lines.get(i).split(%22,%22);%0A      features.set(i, 0, Integer.parseInt(line%5B0%5D));%0A      features.set(i, 1, Integer.parseInt(line%5B1%5D));%0A      outcome.set(i, Integer.parseInt(line%5B2%5D));%0A    %7D%0A%0A    Tuple3%3CDoubleMatrix, DoubleVector, DoubleVector%3E featureNormalize = MathUtils%0A        .featureNormalize(features);%0A    features = featureNormalize.getFirst();%0A%0A    RegressionCostFunction costFunction = new RegressionCostFunction(features,%0A        outcome, 0d);%0A%0A    DoubleVector theta = GradientDescent.minimizeFunction(costFunction,%0A        new DenseDoubleVector(3), 0.01, 1.0e-9, 200, true);%0A    System.out.println(theta);%0A%0A    theta = Fmincg.minimizeFunction(costFunction, new DenseDoubleVector(3),%0A        200, true);%0A    System.out.println(theta);%0A  %7D%0A%0A%7D%0A

add interesting corner case