public static double [ ] logs2probs ( double [ ] a ) { double max = a [ maxIndex ( a ) ] ; double sum = 0.0 ; double [ ] result = new double [ a . length ] ; for ( int i = 0 ; i < a . length ; i ++ ) { result [ i ] = Math . exp ( a [ i ] - max ) ; sum += result [ i ] ; } normalize ( result , sum ) ; return result ; }
Converts an array containing the natural logarithms of probabilities stored in a vector back into probabilities . The probabilities are assumed to sum to one .