public Map < L , Counter < F > > weightsAsMapOfCounters ( ) { Map < L , Counter < F > > mapOfCounters = new HashMap < L , Counter < F > > ( ) ; for ( L label : labelIndex ) { int labelID = labelIndex . indexOf ( label ) ; Counter < F > c = new ClassicCounter < F > ( ) ; mapOfCounters . put ( label , c ) ; for ( F f : featureIndex ) { c . incrementCount ( f , weights [ featureIndex . indexOf ( f ) ] [ labelID ] ) ; } } return mapOfCounters ; }
This method returns a map from each label to a counter of feature weights for that label . Useful for feature analysis .