32 #ifndef SHARK_MODELS_ConvexCombination_H 33 #define SHARK_MODELS_ConvexCombination_H 65 : m_w(outputs,inputs,0.0){
78 {
return "ConvexCombination"; }
82 swap(model1.m_w,model2.m_w);
88 swap(*
this,tempModel);
111 for(std::size_t i = 0; i !=
outputSize(); ++i){
118 return m_w.size1()*m_w.size2();
136 return boost::shared_ptr<State>(
new EmptyState());
141 outputs.resize(inputs.size1(),m_w.size1());
146 eval(inputs,outputs);
151 BatchInputType const& patterns, RealMatrix
const& coefficients,
State const& state, RealVector& gradient
154 SIZE_CHECK(coefficients.size1()==patterns.size1());
162 RealMatrix d =
prod(
trans(coefficients), patterns);
165 for(std::size_t i = 0; i !=
outputSize(); ++i){
167 noalias(
row(weightGradient,i)) = element_prod(
181 SIZE_CHECK(coefficients.size1() == patterns.size1());
183 derivative.resize(patterns.size1(),
inputSize());