public static AssociativeArray median ( DataTable2D classifierClassProbabilityMatrix ) { AssociativeArray combinedClassProbabilities = new AssociativeArray ( ) ; //extract all the classes first for ( Map . Entry < Object , AssociativeArray > entry : classifierClassProbabilityMatrix . entrySet ( ) ) { //Object classifier = entry.getKey(); AssociativeArray listOfClassProbabilities = entry . getValue ( ) ; for ( Map . Entry < Object , Object > entry2 : listOfClassProbabilities . entrySet ( ) ) { Object theClass = entry2 . getKey ( ) ; //Double probability = Dataset.toDouble(entry2.getValue()); combinedClassProbabilities . put ( theClass , 0.0 ) ; } } for ( Map . Entry < Object , Object > entry : combinedClassProbabilities . entrySet ( ) ) { Object theClass = entry . getKey ( ) ; FlatDataCollection listOfProbabilities = new FlatDataCollection ( new ArrayList <> ( ) ) ; for ( Map . Entry < Object , AssociativeArray > entry2 : classifierClassProbabilityMatrix . entrySet ( ) ) { //Object classifier = entry2.getKey(); AssociativeArray listOfClassProbabilities = entry2 . getValue ( ) ; Double probability = listOfClassProbabilities . getDouble ( theClass ) ; if ( probability != null ) { listOfProbabilities . add ( probability ) ; } } combinedClassProbabilities . put ( theClass , Descriptives . median ( listOfProbabilities ) ) ; //listOfProbabilities=null; } return combinedClassProbabilities ; }
Combines the responses of the classifiers by using estimating the median of the probabilities of their responses .