////////////////// Inference ///// //////////////////
| 96 | ///// Inference ///// |
| 97 | /////////////////////// |
| 98 | void expAndNormalize ( MatrixXf & out, const MatrixXf & in ) { |
| 99 | out.resize( in.rows(), in.cols() ); |
| 100 | for( int i=0; i<out.cols(); i++ ){ |
| 101 | VectorXf b = in.col(i); |
| 102 | b.array() -= b.maxCoeff(); |
| 103 | b = b.array().exp(); |
| 104 | out.col(i) = b / b.array().sum(); |
| 105 | } |
| 106 | } |
| 107 | void sumAndNormalize( MatrixXf & out, const MatrixXf & in, const MatrixXf & Q ) { |
| 108 | out.resize( in.rows(), in.cols() ); |
| 109 | for( int i=0; i<in.cols(); i++ ){ |