////////////////// Inference ///// //////////////////
| 191 | ///// Inference ///// |
| 192 | /////////////////////// |
| 193 | void expAndNormalize ( MatrixXf & out, const MatrixXf & in ) { |
| 194 | out.resize( in.rows(), in.cols() ); |
| 195 | for( int i=0; i<out.cols(); i++ ){ |
| 196 | VectorXf b = in.col(i); |
| 197 | b.array() -= b.maxCoeff(); |
| 198 | b = b.array().exp(); |
| 199 | out.col(i) = b / b.array().sum(); |
| 200 | } |
| 201 | } |
| 202 | void sumAndNormalize( MatrixXf & out, const MatrixXf & in, const MatrixXf & Q ) { |
| 203 | out.resize( in.rows(), in.cols() ); |
| 204 | for( int i=0; i<in.cols(); i++ ){ |