@@ -162,11 +162,11 @@ public List<CySubNetwork> generateNegativeExamples(int numExamples, List<CySubNe
162162 }
163163
164164 exponent = getSizeDistributionExponent (positiveExampleSizes );
165- System .out .println ("Exp: " + exponent );
165+ // System.out.println("Exp: " + exponent);
166166
167167 for (i = 0 ; i < sizeDistributionValues .length ; i ++) {
168168 sizeDistributionValues [i ] = (1 /(Math .pow ((i + minSize ), exponent )));
169- System .out .println ("sizeDistributionValues[" + i + "] : " + sizeDistributionValues [i ]);
169+ // System.out.println("sizeDistributionValues[" + i + "] : " + sizeDistributionValues[i]);
170170 sizeDistributionTotal = sizeDistributionTotal + sizeDistributionValues [i ];
171171 }
172172
@@ -177,16 +177,20 @@ public List<CySubNetwork> generateNegativeExamples(int numExamples, List<CySubNe
177177
178178 System .out .println ("Generating negative examples" );
179179 for (i = 0 ; i < sizeDistributionRatios .length ; i ++) {
180+ int failedIterations = 0 ;
180181// System.out.println("sizeDistributionRatios[" + i + "] : " + sizeDistributionRatios[i]);
181182 for (int x = 0 ; x < Math .round (sizeDistributionRatios [i ] * numExamples ); x ++) {
182- System .out .println ("x: " + x );
183+ // System.out.println("x: " + x);
183184 example = genNegativeExample (i + minSize , positiveExamples );
184185 if ((example != null ) && (example .getNodeCount () >= (i + minSize ))) {
185186 negativeExamples .add (example );
186187 }
187188 else {
188189 rootNetwork .removeSubNetwork (example );
189- x --;
190+ if (! (failedIterations > positiveExamples .size ()) ) {
191+ x --;
192+ }
193+ failedIterations ++;
190194 }
191195 }
192196 }
@@ -283,42 +287,63 @@ public void train(List<CySubNetwork> positiveExamples, List<CySubNetwork> negati
283287 System .out .println ("Entered TRAIN" );
284288 List <Cluster > posExamples = new ArrayList <Cluster >(), negExamples = new ArrayList <Cluster >();
285289 for (CySubNetwork pos : positiveExamples ) {posExamples .add (new Cluster (features , pos )); }
290+ for (CySubNetwork neg : negativeExamples ) {negExamples .add (new Cluster (features , neg ));}
291+
286292 System .out .println ("Lists of pos and neg training examples created" );
287293
294+ // System.out.println("TRAINING BINS ON POSITIVE COMPLEXES:");
288295 posBayesGraph .trainBins (posExamples );
289- // Min/Max update
290- System .out .println ("TRAINED BINS ON POSITIVE COMPLEXES:" );
291- for (FeatureSet feature : features ) {
292- List <String > statNames = feature .getDescriptions ();
293- Map <String , Statistic > statMap = feature .getStatisticMap ();
294- for (String statName : statNames ) {
295- Statistic stat = statMap .get (statName );
296- Double min = stat .getRange ().getMin ();
297- Double max = stat .getRange ().getMax ();
298- System .out .println (statName + "\n \t Min: " + min + "\n \t Max: " + max );
299- }
300- }
296+ // for (FeatureSet feature : features) {
297+ // List<String> statNames = feature.getDescriptions();
298+ // Map<String, Statistic> statMap = feature.getStatisticMap();
299+ // for (String statName : statNames) {
300+ // Statistic stat = statMap.get(statName);
301+ // Double min = stat.getRange().getMin();
302+ // Double max = stat.getRange().getMax();
303+ // System.out.println(statName + "\n\tMin: " + min + "\n\tMax: " + max);
304+ // }
305+ // }
301306
307+ // System.out.println("TRAINING BINS ON NEGATIVE COMPLEXES:");
302308 negBayesGraph .trainBins (negExamples );
303- System . out . println ( "TRAINED BINS ON NEGATIVE COMPLEXES:" );
304- for ( FeatureSet feature : features ) {
305- List <String > statNames = feature .getDescriptions ();
306- Map < String , Statistic > statMap = feature . getStatisticMap ();
307- for ( String statName : statNames ) {
308- Statistic stat = statMap . get ( statName );
309- Double min = stat .getRange ().getMin ();
310- Double max = stat . getRange (). getMax ( );
311- System . out . println ( statName + " \n \t Min: " + min + " \n \t Max: " + max );
312- }
313- }
314- // Min/max update
309+ // for (FeatureSet feature : features) {
310+ // List<String> statNames = feature.getDescriptions();
311+ // Map <String, Statistic> statMap = feature.getStatisticMap ();
312+ // for ( String statName : statNames) {
313+ // Statistic stat = statMap.get(statName);
314+ // Double min = stat.getRange().getMin( );
315+ // Double max = stat.getRange().getMax ();
316+ // System.out.println(statName + "\n\tMin: " + min + "\n\tMax: " + max );
317+ // }
318+ // }
319+
320+ // System.out.println("TRAINING PROBABILITY - POSITIVE:");
315321 posBayesGraph .trainOn (posExamples );
316322 // Min/max stable
317- System .out .println ("Model has finished training on " + positiveExamples .size () + " positive Examples." );
318- for (CySubNetwork neg : negativeExamples ) {negExamples .add (new Cluster (features , neg ));}
323+ // for (FeatureSet feature : features) {
324+ // List<String> statNames = feature.getDescriptions();
325+ // Map<String, Statistic> statMap = feature.getStatisticMap();
326+ // for (String statName : statNames) {
327+ // Statistic stat = statMap.get(statName);
328+ // Double min = stat.getRange().getMin();
329+ // Double max = stat.getRange().getMax();
330+ // System.out.println(statName + "\n\tMin: " + min + "\n\tMax: " + max);
331+ // }
332+ // }
319333
334+ // System.out.println("TRAINING PROBABILITY - NEGATIVE:");
320335 negBayesGraph .trainOn (negExamples );
321336 // Min/max stable
337+ // for (FeatureSet feature : features) {
338+ // List<String> statNames = feature.getDescriptions();
339+ // Map<String, Statistic> statMap = feature.getStatisticMap();
340+ // for (String statName : statNames) {
341+ // Statistic stat = statMap.get(statName);
342+ // Double min = stat.getRange().getMin();
343+ // Double max = stat.getRange().getMax();
344+ // System.out.println(statName + "\n\tMin: " + min + "\n\tMax: " + max);
345+ // }
346+ // }
322347 System .out .println ("Model has finished training on " + negativeExamples .size () + " negative Examples." );
323348 }
324349
@@ -363,8 +388,8 @@ else if (! complexList.canRead()) {
363388 clusterNetwork .addNode (rootNetwork .getNode (proteinId ));
364389 else if (! userInput .ignoreMissing )
365390 throw new Exception ("Protein not found in network: " + proteins [i ]);
366- else
367- System .out .println ("Protein not found in network" + proteins [i ]);
391+ // else
392+ // System.out.println("Protein not found in network" + proteins[i]);
368393 }
369394
370395 //test for edges and add to subnetwork
@@ -418,7 +443,7 @@ private double getSizeDistributionExponent(int[] positiveExampleSizes) {
418443 for (int i = 0 ; i < n ; i ++) {
419444 exponent = exponent + Math .log (positiveExampleSizes [i ]/min );
420445 }
421- System .out .println ("exponent: " + exponent );
446+ // System.out.println("exponent: " + exponent);
422447 exponent = 1 + (n / exponent );
423448 } else {
424449 // Avoid dividing by zero
0 commit comments