| 194 | |
| 195 | |
| 196 | //////////////////// |
| 197 | template<class sq_T> |
| 198 | shared_ptr< mlnorm<sq_T> > ARX::ml_predictor ( ) const { |
| 199 | shared_ptr< mlnorm<sq_T> > tmp = new mlnorm<sq_T> ( ); |
| 200 | tmp->set_rv(yrv); |
| 201 | tmp->set_rvc(_rvc()); |
| 202 | |
| 203 | ml_predictor_update(*tmp); |
| 204 | tmp->validate(); |
| 205 | return tmp; |
| 206 | } |
| 207 | |
| 208 | template<class sq_T> |
| 209 | void ARX::ml_predictor_update(mlnorm<sq_T> &pred) const { |
| 210 | mat mu ( dimy, posterior()._V().rows() - dimy ); |
| 211 | mat R ( dimy, dimy ); |
| 212 | |
| 213 | est.mean_mat ( mu, R ); //mu = |
| 214 | mu = mu.T(); |
| 215 | //correction for student-t -- TODO check if correct!! |
| 216 | |
| 217 | if ( have_constant) { // constant term |
| 218 | //Assume the constant term is the last one: |
| 219 | pred.set_parameters ( mu.get_cols ( 0, mu.cols() - 2 ), mu.get_col ( mu.cols() - 1 ), sq_T ( R ) ); |
| 220 | } else { |
| 221 | pred.set_parameters ( mu, zeros ( dimy ), sq_T( R ) ); |
| 222 | } |
| 223 | } |
| 224 | |