35 #ifndef SHARK_MODELS_MEANMODEL_H 36 #define SHARK_MODELS_MEANMODEL_H 40 template<
class ModelType>
41 class MeanModel :
public AbstractModel<typename ModelType::InputType, RealVector, typename ModelType::ParameterVectorType>
44 template<
class T>
struct tag{};
46 template<
class InputBatch>
47 void doEval(InputBatch
const& patterns, RealMatrix& outputs, tag<RealVector>)
const{
48 for(std::size_t i = 0; i !=
m_models.size(); i++)
52 template<
class InputBatch>
53 void doEval(InputBatch
const& patterns, RealMatrix& outputs, tag<unsigned int>)
const{
54 blas::vector<unsigned int> responses;
55 for(std::size_t i = 0; i !=
m_models.size(); ++i){
56 m_models[i].eval(patterns, responses);
57 for(std::size_t p = 0; p != patterns.size1(); ++p){
59 outputs(p,responses(p)) +=
m_weight[i];
75 {
return "MeanModel"; }
87 void eval(BatchInputType
const& patterns, BatchOutputType& outputs)
const{
90 doEval(patterns,outputs, tag<typename ModelType::OutputType>());
93 void eval(BatchInputType
const& patterns, BatchOutputType& outputs,
State& state)
const{
94 eval(patterns,outputs);
147 double const&
weight(std::size_t i)
const{
154 m_weight[i] = newWeight;
183 #endif // SHARK_MODELS_MEANMODEL_H