Debian Codegraph @

current/ml/Cell.java

raw symbols SCIP
1 package ml;
2
3 import java.util.Arrays;
4 import java.util.Random;
5
6 import shared.Tools;
7 import shared.Vector;
8
9 public class Cell extends Source {
10
11 /*--------------------------------------------------------------*/
12 /*---------------- Initialization ----------------*/
13 /*--------------------------------------------------------------*/
14
15 public Cell(int id_, int activationType, int lpos_, int layer_, int maxLayer_,
16 int prevLayerStart_, int nextLayerStart_, int wid,
17 float[] values_, float[] eOverNetArray_) {
18 id=id_;
19 // type=activationType;
20 function=Function.getFunction(activationType);
21 lpos=lpos_;
22 layer=layer_;
23 maxLayer=maxLayer_;
24 values=values_;
25 eOverNetArray=eOverNetArray_;
26 assert(values.length==wid);
27 prevLayerStart=prevLayerStart_;
28 nextLayerStart=nextLayerStart_;
29
30 //Initialize later
31 // inputs=in;
32 // outputs=out;
33 // weights=(inputs==null || inputs.length<1 ? null : new float[inputs.length]);
34 // deltas=(inputs==null || inputs.length<1 ? null : new float[inputs.length]);
35
36 assert(lpos>=0 & lpos<wid);
37 }
38
39 /*--------------------------------------------------------------*/
40 /*---------------- Non-Mutators ----------------*/
41 /*--------------------------------------------------------------*/
42
43 public void summateDense(float[] valuesIn) {
44 sum=bias;
45 assert(valuesIn.length==weights.length) : valuesIn.length+", "+weights.length;
46 sum+=Vector.fma(weights, valuesIn);
47 final float v=(float)activation(sum);
48 setValue(v);
49 }
50
51 public void summateSparse(float[] valuesIn, int edgeBlockSize) {
52 sum=bias;
53 sum+=Vector.fma(weights, valuesIn, inputs, edgeBlockSize, Vector.SIMD_FMA_SPARSE);
54 final float v=(float)activation(sum);
55 setValue(v);
56 }
57
58 public float calcError(float ideal) {
59 float e=ideal-value();
60 return 0.5f*e*e;
61 }
62
63 synchronized public boolean check() {
64 // assert(false);
65
66 if(!CellNet.DENSE) {
67 assert(layer==maxLayer || outputs!=null) :
68 layer+", "+maxLayer+", "+lpos+", "+id();
69 }
70
71 if(value!=values[lpos] && (value!=-1 && values[lpos]!=0)) {
72 assert(false) : id+", "+layer+", "+lpos+": "+value+", "+values[lpos]+", "+Arrays.toString(values);
73 return false;
74 }
75 if(eOverNet!=eOverNetArray[lpos]) {
76 assert(false) : id+", "+layer+", "+lpos+": "+eOverNet+", "+eOverNetArray[lpos]+", "+Arrays.toString(values);
77 return false;
78 }
79 if(layer>0) {
80 assert(weights!=null);
81 assert(CellNet.DENSE==(inputs==null));
82 // assert(weights2.length==weights.length);
83 assert(deltas==null || deltas.length==weights.length);
84 // for(int i=0; i<weights2.length; i++) {
85 // Edge e=outputs.get(i);
86 // if(e.weight2!=weights2[i]) {
87 // assert(false) : id+", "+layer+", "+lpos+": "+e.weight2+", "+weights2[i];
88 // return false;
89 // }
90 // }
91 }else {
92 // assert(inputs==null || outputs.isEmpty()) : id+", "+layer+", "+lpos+": "+weights2+": "+outputs+"\n"+toString()+"\n";
93 assert(inputs==null || outputs==null) : id+", "+layer+", "+lpos+": "+deltas+": "+outputs+"\n"+toString()+"\n";
94 }
95 return true;
96 }
97
98 /*--------------------------------------------------------------*/
99 /*---------------- Mutators ----------------*/
100 /*--------------------------------------------------------------*/
101
102 void applyUpdates(float invSamples, float alpha) {//only called once per epoch
103 if(layer<1) {return;}
104 adjustBias(invSamples, alpha);
105 for(int i=0; i<weights.length; i++) {
106 final float w=weights[i];
107
108 final float d3=(float)(deltas[i]*invSamples*alpha);
109 float w4=w+d3;
110 {
111 final float absW4=Math.abs(w4);
112 if(absW4>Math.abs(w) && absW4>edgeAmplitudeIncreaseThresh) {
113 //Very sensitive; strong values break convergence.
114 //0.98 seems OK though. Goal is to keep edges low.
115 //.94 is too extreme. .96 seems OK.
116 w4=w+edgeAmplitudeIncreaseMult*d3;//Slow down increase in edge magnitude
117 }
118 }
119 deltas[i]=0;
120
121 if((w!=0 || !CellNet.DENSE) && Math.abs(w4)>Float.MIN_NORMAL) {weights[i]=w4;}
122 }
123 }
124
125 public void addError(float e) {
126 assert(error>=0);
127 error+=e;
128 }
129
130 public void clearError() {
131 error=0;
132 }
133
134 public void clearTemp() {
135 // bias2=0;
136 biasDelta=0;
137 error=0;
138 if(layer<1) {return;}
139 // Arrays.fill(weights2, 0);
140 assert(deltas!=null) : id()+", "+layer;
141 Arrays.fill(deltas, 0);
142 }
143
144 public void setBias(float b2, boolean ignoreAssertion) {
145 assert(layer>0);
146 // float dif=Tools.absdif(bias, b2);
147 // assert(ignoreAssertion || dif<0.1f || dif<0.2f*bias) : dif+", "+bias+", "+b2; //just checking for bugs.
148 // if(!(ignoreAssertion || dif<0.1f || dif<0.2f*bias)) {System.out.print("*");}
149 // if(!ignoreAssertion) {System.err.println(bias);}
150 bias=b2;
151 }
152
153 private void adjustBias(float invSamples, float alpha) {
154 assert(layer>0);
155 assert(alpha>0) : alpha;
156 // System.err.println(String.format("b"+id()+": %.5f -> %.5f * %.2f = %.5f",
157 // bias, bias2, invSamples, bias2*invSamples));
158 // float b=((float)bias2)*invSamples;
159 float bFromDelta=(float)(bias+biasDelta*invSamples*alpha*biasAlphaMult);
160 // assert(Tools.absdif(b, bFromDelta)<0.00001) : "b="+b+", bFD="+bFromDelta+", bias="+bias+", bias2="+bias2+", bD="+biasDelta+", invS="+invSamples+", a="+alpha+", bAM="+biasAlphaMult
161 // +", layer="+layer+" cid="+id;
162 setBias(bFromDelta, false);
163 // bias2=0;
164 biasDelta=0;
165 }
166
167 public void addError(Cell c2) {
168 error+=c2.error;
169 }
170
171 @Override
172 public void setValue(float v) {
173 assert(layer==0 || v==(float)activation(sum)) : v+", "+activation(sum)+", "+sum;
174 // assert(value==values[lpos]);
175 values[lpos]=value=v;
176 }
177
178 /*--------------------------------------------------------------*/
179
180 public final double activation(double x) {
181 return function.activate(x);
182 }
183
184 public final double derivativeXFX(double x, double fx) {
185 double d=function.derivativeXFX(x, fx);
186 assert(!Double.isNaN(d)) : x+", "+fx+", "+d;
187 return d;
188 }
189
190 /*--------------------------------------------------------------*/
191
192 //TODO: Vectorize? Final layer is usually small though
193 void updateEdgesFinalLayerDense(float target, float[] valuesIn, float weightMult) {
194 //assert(check());
195 final float v=value();
196 eTotalOverOut=calcETotalOverOut(v, target, weightMult);
197 outOverNet=(float)derivativeXFX(sum, v);
198 // final double eTotalOverOut_X_outOverNet=eTotalOverOut*outOverNet;
199 eOverNet=eOverNetArray[lpos]=eTotalOverOut*outOverNet;
200
201 for(int i=0; i<weights.length; i++) {
202 // assert(e.source.check());
203 final float netOverWeight=valuesIn[i];//e.source.value();
204 // assert(valuesIn[i]==e.source.value) : valuesIn[i]+", "+e.source.value+", "+valuesIn.length+", "+inputs.size();
205 final float eTotalOverWeight=eOverNet*netOverWeight;
206
207 // final double w=weights[i];
208 // final double incr=w-alpha*eTotalOverWeight;
209 // weights2[i]+=incr;
210
211 deltas[i]-=eTotalOverWeight;
212 //TODO: Alpha is not really needed here;
213 //the result could be accumulated and multiplied by alpha at the end
214 }
215 {
216 assert(layer>0);
217 // bias2+=bias-alpha*eOverNet*biasAlphaMult;
218 biasDelta-=eOverNet;
219 }
220 //assert(check());
221 }
222
223 /*--------------------------------------------------------------*/
224
225 public void updateEdgesHiddenLayerDense(float[] valuesIn, float[] eOverNetNext, float[] weightsOut) {
226 //assert(check());
227 // eTotalOverOut=0;
228 final float v=value();
229 assert(v==values[lpos]) : v+", "+values[lpos]+//Also fires on NaN, but that shouldn't happen...
230 "\n"+Arrays.toString(values)+
231 "\n"+Arrays.toString(weights)+"\n";
232 outOverNet=(float)derivativeXFX(sum, v);
233
234 assert(CellNet.DENSE);
235 if(!CellNet.SPECIAL_FMA) {
236 eTotalOverOut=Vector.fma(weightsOut, eOverNetNext);
237 }
238
239 // if(CellNet.SIMD && eOverNetNext.length>=16) {
240 // eTotalOverOut=shared.Vector.fma(weightsOut, eOverNetNext);
241 // }else {
242 // for(int dest=0; dest<eOverNetNext.length; dest++){
243 // final float netOverOut=weightsOut[dest];
244 // final float eOverNetDest=eOverNetNext[dest];
245 // final float eOverOut=eOverNetDest*netOverOut;
246 //
247 // eTotalOverOut+=eOverOut;
248 // }
249 // }
250
251 eOverNetArray[lpos]=eOverNet=eTotalOverOut*outOverNet;
252
253 // for(int source=0; source<valuesPrev.length; source++) {
254 // final float netOverWeight=valuesPrev[source];
255 // final float eTotalOverWeight=eOverNet*netOverWeight;
256 //
257 //// final double incr=weights[source]-alpha*eTotalOverWeight;
258 //// weights2[source]+=incr;
259 //
260 // deltas[source]-=eTotalOverWeight;
261 // }
262 Vector.addProduct(deltas, valuesIn, -eOverNet);
263
264 // if(layer>0){
265 {
266 assert(layer>0) : layer;
267 // bias2+=bias-alpha*eOverNet*biasAlphaMult;//Bias adjusts slower than edges
268 biasDelta-=eOverNet;
269 }
270 //assert(check());
271 }
272
273 public void updateEdgesHiddenLayerSparse(float[] valuesIn, float[] eOverNetNext,
274 float[] weightsOut, int edgeBlockSize) {
275 //assert(check());
276 // eTotalOverOut=0;
277 final float v=value();
278 assert(v==values[lpos]) : v+", "+values[lpos]+//Also fires on NaN, but that shouldn't happen...
279 "\n"+Arrays.toString(values)+
280 "\n"+Arrays.toString(weights)+"\n";
281 outOverNet=(float)derivativeXFX(sum, v);
282
283 assert(!CellNet.DENSE);
284 eTotalOverOut=Vector.fma(weightsOut, eOverNetNext, outputs, 1, false);
285
286 // if(CellNet.SIMD && eOverNetNext.length>=16) {
287 // eTotalOverOut=shared.Vector.fma(weightsOut, eOverNetNext);
288 // }else {
289 // for(int dest=0; dest<eOverNetNext.length; dest++){
290 // final float netOverOut=weightsOut[dest];
291 // final float eOverNetDest=eOverNetNext[dest];
292 // final float eOverOut=eOverNetDest*netOverOut;
293 //
294 // eTotalOverOut+=eOverOut;
295 // }
296 // }
297
298 eOverNetArray[lpos]=eOverNet=eTotalOverOut*outOverNet;
299
300 // for(int source=0; source<valuesPrev.length; source++) {
301 // final float netOverWeight=valuesPrev[source];
302 // final float eTotalOverWeight=eOverNet*netOverWeight;
303 //
304 //// final double incr=weights[source]-alpha*eTotalOverWeight;
305 //// weights2[source]+=incr;
306 //
307 // deltas[source]-=eTotalOverWeight;
308 // }
309 Vector.addProduct(deltas, valuesIn, inputs, -eOverNet, edgeBlockSize);
310
311 // if(layer>0){
312 {
313 assert(layer>0) : layer;
314 // bias2+=bias-alpha*eOverNet*biasAlphaMult;//Bias adjusts slower than edges
315 biasDelta-=eOverNet;
316 }
317 //assert(check());
318 }
319
320 /*--------------------------------------------------------------*/
321
322 public void accumulate(Cell c2) {
323 //assert(check());
324 //assert(c2.check());
325 error+=c2.error;
326 // bias2+=c2.bias2;
327 biasDelta+=c2.biasDelta;
328 // if(layer>0) {
329 // final double[] c2w2=c2.weights2;
330 // for(int i=0; i<weights2.length; i++) {
331 // weights2[i]+=c2w2[i];
332 // }
333 // }
334 if(layer>0) {
335 // final float[] c2d=c2.deltas;
336 // for(int i=0; i<deltas.length; i++) {
337 // deltas[i]+=c2d[i];
338 // }
339 Vector.add(deltas, c2.deltas);
340 }
341 }
342
343 /*--------------------------------------------------------------*/
344
345 public void anneal(float strength, Random randy) {
346 if(layer<1){return;}
347 if(annealBias) {
348 final float abs=Math.abs(bias);
349 float xb=strength*(randy.nextFloat()-randy.nextFloat())*biasAnnealMult;
350 if(abs<0.2f) {xb=xb*(Tools.max(abs*5, 0.2f));} //Weaker anneal for weaker bias //TODO: Make lower limit even weaker
351 setBias(bias+xb, true);
352 }
353 for(int i=0; i<weights.length; i++) {
354 // final Edge e=inputs.get(i);
355 final float w=weights[i];
356 if(w!=0) {
357 // assert(w==e.weight());
358 final float abs=Math.abs(w);
359 float xe=strength*(randy.nextFloat()-randy.nextFloat());
360 if(abs<lowWeightAnnealCutoff) {xe=xe*(Tools.max(abs*lowWeightAnnealMult, lowWeightAnnealCutoff));} //Weaker anneal for weaker weight
361 if(Math.abs(w+xe)>abs) {xe*=edgeAmplitudeIncreaseMult;} //Weaker anneal when it increases absolute magnitude of weight
362 final float w2=w+xe;
363 // e.setWeight(w2);
364 if(Math.abs(w2)>Float.MIN_NORMAL) {weights[i]=w2;}
365 // assert(w2==e.weight());
366 }
367 }
368 }
369
370 public void setFrom(Cell c, boolean copyDelta) {
371 eTotalOverOut=c.eTotalOverOut;
372 outOverNet=c.outOverNet;
373 bias=c.bias;
374 // type=c.type;
375 function=c.function;
376 value=c.value;
377 sum=c.sum;
378 error=c.error;
379 // if(layer==0){return;}
380 if(weights==null) {
381 weights=(c.weights==null ? null : Arrays.copyOf(c.weights, c.weights.length));
382 assert(inputs==null);
383 inputs=(c.inputs==null ? null : Arrays.copyOf(c.inputs, c.inputs.length));
384 }else{
385 Vector.copy(weights, c.weights);
386 if(!CellNet.DENSE) {Vector.copy(inputs, c.inputs);}
387 }
388
389 if(outputs==null) {
390 outputs=(c.outputs==null ? null : Arrays.copyOf(c.outputs, c.outputs.length));
391 }else{
392 Vector.copy(outputs, c.outputs);
393 }
394
395 biasDelta=0;
396 if(copyDelta) {
397 biasDelta=c.biasDelta;
398 deltas=(c.deltas==null ? null : Arrays.copyOf(c.deltas, c.deltas.length));
399 }else if(deltas==null){
400 deltas=(weights==null ? null : new float[weights.length]);//(c.deltas==null ? null : new float[c.deltas.length]);
401 }else {
402 Arrays.fill(deltas, 0);
403 }
404 assert(Tools.equals(inputs, c.inputs));
405 assert(Tools.equals(outputs, c.outputs));
406 assert(Tools.equals(weights, c.weights));
407 // assert(false) : outputs+", "+c.outputs;
408
409 //assert(check());
410 //assert(c.check());
411 // assert(c.weights.length==weights.length) : "\n"+inputs+"\n"+c.inputs;
412 }
413
414 /*--------------------------------------------------------------*/
415 /*---------------- Overrides ----------------*/
416 /*--------------------------------------------------------------*/
417
418 @Override
419 public String toString() {
420 StringBuilder sb=new StringBuilder();
421 // sb.append("C"+id()+": v="+String.format("%.4f, b=%.4f, b2=%.4f, e=%.5f", value(), bias, bias2, error));
422 sb.append("C"+id()+": v="+String.format("%.4f, b=%.4f, b2=%.4f, e=%.5f", value(), bias, biasDelta, error));
423 if(!terminal()) {
424 sb.append(", Edges: {");
425 if(CellNet.DENSE) {
426 int prevBase=id-lpos-weights.length;
427 for(int i=0; i<weights.length; i++) {
428 //TODO: Could use source array or source value array here
429 // return String.format("C"+(prevBase+i)+"->C"+id+",%.3f,w?=%.4f,w2=%.4f,d=%.4f; ", -1, weights[i], weights2[i], deltas[i]);
430 sb.append(String.format("C"+(prevBase+i)+"->C"+id+",%.3f,w?=%.4f,d=%.4f; ", -1, weights[i], deltas[i]));
431 }
432 }else {
433 for(int i=0; i<weights.length; i++) {
434 final int prev=inputs[i]+prevLayerStart;
435 sb.append(String.format("C"+(prev)+"->C"+id+",%.3f,w?=%.4f,d=%.4f; ", -1, weights[i], deltas[i]));
436 }
437 }
438 sb.setLength(sb.length()-2);
439 sb.append("}");
440 }
441 return sb.toString();
442 }
443
444 @Override
445 public boolean terminal() {
446 // return inputs==null || inputs.isEmpty();
447 return layer==0;
448 }
449
450 /*--------------------------------------------------------------*/
451 /*---------------- Getters ----------------*/
452 /*--------------------------------------------------------------*/
453
454 public int id() {return id;}
455 public float bias() {return bias;}
456
457 /*--------------------------------------------------------------*/
458 /*---------------- Static Methods ----------------*/
459 /*--------------------------------------------------------------*/
460
461 public static float toWeightedError(double rawError, float v, float target, float weightMult) {
462 if(weightMult==0) {return (float)rawError;}
463 // assert(rawError>=0) : rawError;
464 float mult=toErrorMult(v, target, weightMult);
465 double incr=toErrorIncr(rawError, v, target);
466 assert(incr==0 || incr>=0 == rawError>=0) : incr+", "+rawError;
467 return (float)((rawError+incr)*mult);
468 }
469
470 public static double toErrorIncr(double rawError, float v, float target) {
471 double incr=0;
472 if(target>cutoffForTraining) {
473 if(v<=cutoffForTraining+spread) {incr=fnErrorIncr;}
474 }else if(target<cutoffForTraining) {
475 if(v>=cutoffForTraining-spread) {incr=fpErrorIncr;}
476 }
477 double ret=incr*(rawError>=0 ? 1 : -1);
478 return ret;
479 }
480
481 // public static float toErrorMult(float v, float target) {
482 // if(true) {return toErrorMult(v, target, 1);}
483 // final float mult;
484 //// assert(cutoff-spread==lowThresh);
485 //// assert(cutoff+spread==highThresh);
486 //// if(v>target) {
487 //// mult=positiveErrorMult;
488 //// if(v>lowThresh && target<lowThresh) {
489 //// mult*=falsePositiveErrorMult;
490 //// }
491 //// }else{
492 //// mult=negativeErrorMult;
493 //// if(v<highThresh && target>=highThresh) {
494 //// mult*=falseNegativeErrorMult;
495 //// }
496 //// }
497 // if(v>target) {
498 // if(v>cutoff-spread && target<cutoff+spread) {
499 // mult=falsePositiveErrorMult;
500 // }else{
501 // mult=positiveErrorMult;
502 // }
503 // }else{
504 // if(v<cutoff+spread && target>=cutoff-spread) {
505 // mult=falseNegativeErrorMult;
506 // }else{
507 // mult=negativeErrorMult;
508 // }
509 // }
510 // return mult;
511 // }
512
513 //TODO: multFraction comes from TrainerThread.weightMult() and is basically always 1
514 //It should probably be eliminated
515 //But test first; it's a way of preventing fpem from being too strong early via "minweightepoch=500" or whatever
516 public static float toErrorMult(float v, float target, float multFraction) {
517 if(v==target) {return 0;}
518 final float mult;
519 final boolean positiveError=v>target;
520 final boolean positiveGoal=target>cutoffForTraining;
521 final boolean negativeGoal=target<cutoffForTraining;
522 final boolean excess=(positiveError == positiveGoal);
523 // final boolean offsides=(positiveGoal && v<)
524 if(positiveError) {
525 if(positiveGoal) {
526 assert(excess);
527 mult=excessPositiveErrorMult;
528 }else if(v>cutoffForTraining-spread){//offsides; false positive
529 mult=falsePositiveErrorMult;
530 }else {
531 mult=positiveErrorMult;
532 }
533 }else{//Negative error
534 if(negativeGoal) {
535 assert(excess);
536 mult=excessNegativeErrorMult;
537 }else if(v<cutoffForTraining+spread){//offsides; false negative
538 mult=falseNegativeErrorMult;
539 }else {
540 mult=negativeErrorMult;
541 }
542 }
543 return ((mult-1)*multFraction)+1; //multFraction=0.5, for example, returns halfway between 1.0 and mult
544 }
545
546 public static float calcETotalOverOut(float v, float target, float weightMult) {
547 float eTotalOverOut=v-target; //Aka out-target
548 final float ret=toWeightedError(eTotalOverOut, v, target, weightMult);
549 return ret;
550 }
551
552 public static void setLowWeightAnnealCutoff(float c) {
553 assert(c>=0 && c<=1);
554 lowWeightAnnealCutoff=c;
555 lowWeightAnnealMult=Tools.max(1f, 1f/Tools.max(lowWeightAnnealCutoff, 0.0001f));
556 }
557
558 /*--------------------------------------------------------------*/
559
560 public final String typeString() {
561 return function.name();
562 }
563
564 /*--------------------------------------------------------------*/
565
566 //Fake legacy method
567 public void updateEdgesHiddenLayerDense(float alpha, float[] valuesIn, double[] eOverNetNext, float[] weightsOut) {
568 throw new RuntimeException("Wrong method, for legacy double[] version in class CellNetDouble");
569 }
570
571 //Fake legacy method
572 public Cell(int size, int type, int i, int layerNum, int prevWidth, int width, int nextWidth, float[] lvals,
573 double[] eons) {
574 throw new RuntimeException("Legacy constructor for CellNetDouble");
575 }
576
577 /*--------------------------------------------------------------*/
578 /*---------------- Fields ----------------*/
579 /*--------------------------------------------------------------*/
580
581 public float eTotalOverOut;
582 public float outOverNet;
583 public float eOverNet;
584 public double sum=0;
585
586 public float bias;
587 // private double bias2;
588 private double biasDelta;
589 public double error;
590 private final int id;
591 final int lpos;//position within layer
592 final int layer;
593 final int maxLayer;
594 int nextWeight=0; //For use when loading networks
595
596 // int type;//TODO: Change to Function.
597 Function function;
598
599 /*--------------------------------------------------------------*/
600
601 final int prevLayerStart;
602 final int nextLayerStart;
603
604 //Lpos (layer position) of inputs
605 public int[] inputs;
606 public int[] outputs;
607 public float[] weights;
608 float[] deltas;
609
610 /*--------------------------------------------------------------*/
611
612 private final float[] values;
613 public final float[] eOverNetArray;
614
615 /*--------------------------------------------------------------*/
616 /*---------------- Statics ----------------*/
617 /*--------------------------------------------------------------*/
618
619 public static int MAX_TYPE=Function.TANH;
620 public static int defaultActivationType=Function.SIG;
621 public static int finalLayerType=Function.RSLOG;
622 public static float randomTypeRate=0.0f;
623
624 static float biasAlphaMult=1f;
625 static float biasAnnealMult=0.5f;
626 static boolean annealBias=true;
627
628 private static float lowWeightAnnealCutoff=0.2f;
629 private static float lowWeightAnnealMult=1f/lowWeightAnnealCutoff;
630
631 static float cutoffForTraining=0.5f;
632 static boolean setCutoffForTraining=false;
633 static boolean useMidpoint=false;
634
635 static float positiveErrorMult=1.0f;
636 static float falsePositiveErrorMult=10.5f;
637 //0.2 is best for binary classification; otherwise 1.0 is probably better
638 //Should be paired with adjusting the Sample pivot function.
639 static float excessPositiveErrorMult=0.2f;
640
641 static float negativeErrorMult=1.0f;
642 static float falseNegativeErrorMult=10.5f;
643 static float excessNegativeErrorMult=0.2f;
644
645 //Optimal BBMerge settings at the time
646 // static float positiveErrorMult=1.65f;
647 // static float falsePositiveErrorMult=12.5f;
648 // static float excessPositiveErrorMult=1f;
649 //
650 // static float negativeErrorMult=0.825f;
651 // static float falseNegativeErrorMult=2.7f;
652 // static float excessNegativeErrorMult=1f;
653
654 static float fnErrorIncr=0.01f;
655 static float fpErrorIncr=0.00f;
656 static float spread=0.050f;
657 static float edgeAmplitudeIncreaseMult=0.98f;
658 static float edgeAmplitudeIncreaseThresh=0.1f;
659
660 }