MCPcopy Create free account
hub / github.com/WinVector/Logistic / testNormOpt

Method testNormOpt

test/com/winvector/logistic/TestOpt.java:97–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95 }
96
97 public void testNormOpt() {
98 // norm penalty should put max at 0 (and max value should be 0)
99 final int dim = 3;
100 final VectorFn f = new NormPenalty(dim,1.0e-2);
101 final double[] x = new double[dim];
102 x[1] = 0.1;
103 x[2] = -0.1;
104 final Newton opt = new Newton();
105 final VEval r = opt.maximize(f,x,10);
106 assertNotNull(r);
107 assertNotNull(r.x);
108 assertEquals(dim,r.x.length);
109 for(int i=0;i<dim;++i) {
110 assertTrue(Math.abs(r.x[i])<1.0e-3);
111 }
112 }
113
114}

Callers

nothing calls this directly

Calls 1

maximizeMethod · 0.95

Tested by

no test coverage detected