@Test public void testMinimum() { logger.info("minimum"); DataTable2D classifierClassProbabilityMatrix = getClassifierClassProbabilityMatrix(); AssociativeArray expResult = new AssociativeArray(); expResult.put("class1", 0.0); expResult.put("class2", 0.333); expResult.put("class3", 0.2); AssociativeArray result = FixedCombinationRules.minimum(classifierClassProbabilityMatrix); for(Object k: expResult.keySet()) { assertEquals(TypeInference.toDouble(expResult.get(k)), TypeInference.toDouble(result.get(k)), Constants.DOUBLE_ACCURACY_HIGH); } }
public static AssociativeArray minimum(DataTable2D classifierClassProbabilityMatrix) { AssociativeArray combinedClassProbabilities = new AssociativeArray(); for(Map.Entry<Object, AssociativeArray> entry : classifierClassProbabilityMatrix.entrySet()) { AssociativeArray listOfClassProbabilities = entry.getValue(); for(Map.Entry<Object, Object> entry2 : listOfClassProbabilities.entrySet()) { Object theClass = entry2.getKey(); Double probability = TypeInference.toDouble(entry2.getValue()); Double previousValue = combinedClassProbabilities.getDouble(theClass); if(previousValue==null || probability<previousValue) { combinedClassProbabilities.put(theClass, probability); } } } return combinedClassProbabilities; }
FixedCombinationRules { public static AssociativeArray minimum(DataTable2D classifierClassProbabilityMatrix) { AssociativeArray combinedClassProbabilities = new AssociativeArray(); for(Map.Entry<Object, AssociativeArray> entry : classifierClassProbabilityMatrix.entrySet()) { AssociativeArray listOfClassProbabilities = entry.getValue(); for(Map.Entry<Object, Object> entry2 : listOfClassProbabilities.entrySet()) { Object theClass = entry2.getKey(); Double probability = TypeInference.toDouble(entry2.getValue()); Double previousValue = combinedClassProbabilities.getDouble(theClass); if(previousValue==null || probability<previousValue) { combinedClassProbabilities.put(theClass, probability); } } } return combinedClassProbabilities; } }
FixedCombinationRules { public static AssociativeArray minimum(DataTable2D classifierClassProbabilityMatrix) { AssociativeArray combinedClassProbabilities = new AssociativeArray(); for(Map.Entry<Object, AssociativeArray> entry : classifierClassProbabilityMatrix.entrySet()) { AssociativeArray listOfClassProbabilities = entry.getValue(); for(Map.Entry<Object, Object> entry2 : listOfClassProbabilities.entrySet()) { Object theClass = entry2.getKey(); Double probability = TypeInference.toDouble(entry2.getValue()); Double previousValue = combinedClassProbabilities.getDouble(theClass); if(previousValue==null || probability<previousValue) { combinedClassProbabilities.put(theClass, probability); } } } return combinedClassProbabilities; }  }
FixedCombinationRules { public static AssociativeArray minimum(DataTable2D classifierClassProbabilityMatrix) { AssociativeArray combinedClassProbabilities = new AssociativeArray(); for(Map.Entry<Object, AssociativeArray> entry : classifierClassProbabilityMatrix.entrySet()) { AssociativeArray listOfClassProbabilities = entry.getValue(); for(Map.Entry<Object, Object> entry2 : listOfClassProbabilities.entrySet()) { Object theClass = entry2.getKey(); Double probability = TypeInference.toDouble(entry2.getValue()); Double previousValue = combinedClassProbabilities.getDouble(theClass); if(previousValue==null || probability<previousValue) { combinedClassProbabilities.put(theClass, probability); } } } return combinedClassProbabilities; }  static AssociativeArray sum(DataTable2D classifierClassProbabilityMatrix); static AssociativeArray average(DataTable2D classifierClassProbabilityMatrix); static AssociativeArray weightedAverage(DataTable2D classifierClassProbabilityMatrix, AssociativeArray classifierWeights); static AssociativeArray median(DataTable2D classifierClassProbabilityMatrix); static AssociativeArray maximum(DataTable2D classifierClassProbabilityMatrix); static AssociativeArray minimum(DataTable2D classifierClassProbabilityMatrix); static AssociativeArray product(DataTable2D classifierClassProbabilityMatrix); static AssociativeArray majorityVote(DataTable2D classifierClassProbabilityMatrix); }
FixedCombinationRules { public static AssociativeArray minimum(DataTable2D classifierClassProbabilityMatrix) { AssociativeArray combinedClassProbabilities = new AssociativeArray(); for(Map.Entry<Object, AssociativeArray> entry : classifierClassProbabilityMatrix.entrySet()) { AssociativeArray listOfClassProbabilities = entry.getValue(); for(Map.Entry<Object, Object> entry2 : listOfClassProbabilities.entrySet()) { Object theClass = entry2.getKey(); Double probability = TypeInference.toDouble(entry2.getValue()); Double previousValue = combinedClassProbabilities.getDouble(theClass); if(previousValue==null || probability<previousValue) { combinedClassProbabilities.put(theClass, probability); } } } return combinedClassProbabilities; }  static AssociativeArray sum(DataTable2D classifierClassProbabilityMatrix); static AssociativeArray average(DataTable2D classifierClassProbabilityMatrix); static AssociativeArray weightedAverage(DataTable2D classifierClassProbabilityMatrix, AssociativeArray classifierWeights); static AssociativeArray median(DataTable2D classifierClassProbabilityMatrix); static AssociativeArray maximum(DataTable2D classifierClassProbabilityMatrix); static AssociativeArray minimum(DataTable2D classifierClassProbabilityMatrix); static AssociativeArray product(DataTable2D classifierClassProbabilityMatrix); static AssociativeArray majorityVote(DataTable2D classifierClassProbabilityMatrix);  }