private void runTest(boolean local, TestFunction test) throws Exception { Properties conf = createConf(local); LivyClient client = null; try { test.config(conf); client = new LivyClientBuilder(new URI("local:spark")).setAll(conf).build(); test.call(client); } finally { if (client != null) { client.stop(); } } }
// @Test public void demo1() { TsData s = Data.X.log(); TestFunction fn = new TestFunction(s); ISsqFunctionMinimizer min = new ec.tstoolkit.maths.realfunctions.levmar.LevenbergMarquardtMethod(); // ISsqFunctionMinimizer min = new // ec.tstoolkit.maths.realfunctions.minpack.LevenbergMarquardtMinimizer(); // min.setConvergenceCriterion(1e-9); min.setMaxIter(10); min.minimize(fn, new TestFunctionInstance(s)); TestFunctionInstance rslt = (TestFunctionInstance) min.getResult(); double[] gradient = fn.getDerivatives(rslt).getGradient(); System.out.println("X"); printRslt(rslt); }