25 #ifndef _MEAN_COMBINED_HPP_ 26 #define _MEAN_COMBINED_HPP_ 28 #include <boost/numeric/ublas/vector_proxy.hpp> 44 virtual int init(
size_t input_dim,
53 void setParameters(
const vectord &theta)
55 using boost::numeric::ublas::subrange;
57 size_t n_lhs = left->nParameters();
58 size_t n_rhs = right->nParameters();
59 if (theta.size() != n_lhs + n_rhs)
61 throw std::invalid_argument(
"Wrong number of mean function parameters");
64 left->setParameters(subrange(theta,0,n_lhs));
65 right->setParameters(subrange(theta,n_lhs,n_lhs+n_rhs));
68 vectord getParameters()
70 using boost::numeric::ublas::subrange;
72 size_t n_lhs = left->nParameters();
73 size_t n_rhs = right->nParameters();
74 vectord par(n_lhs + n_rhs);
75 subrange(par,0,n_lhs) = left->getParameters();
76 subrange(par,n_lhs,n_lhs+n_rhs) = right->getParameters();
82 size_t n_lhs = left->nParameters();
83 size_t n_rhs = right->nParameters();
103 double getMean(
const vectord &x)
105 return left->getMean(x) + right->getMean(x);
108 vectord getFeatures(
const vectord &x)
110 using boost::numeric::ublas::subrange;
112 size_t n_lhf = left->nFeatures();
113 size_t n_rhf = right->nFeatures();
114 vectord feat(n_lhf + n_rhf);
115 subrange(feat,0,n_lhf) = left->getFeatures(x);
116 subrange(feat,n_lhf,n_lhf+n_rhf) = right->getFeatures(x);
122 size_t n_lhf = left->nFeatures();
123 size_t n_rhf = right->nFeatures();
124 return n_lhf + n_rhf;
Namespace of the library interface.
Interface for mean functors.
Abstract class for combined functions.
Mean (parametric) functions.