7 #include<shark/Models/ConvexCombination.h> 14 using namespace shark;
18 int main(
int argc,
char **argv) {
20 cerr <<
"usage: " << argv[0] <<
" (filename)" << endl;
28 normalizingTrainer.
train(normalizer, data);
29 data = normalizer(data);
32 cerr <<
"unable to read data from file " << argv[1] << endl;
37 std::size_t hiddens = 2;
38 unsigned numberOfSteps = 100;
43 ConvexCombination combination;
44 combination.setStructure(hiddens);
54 optimizer.
init(error);
56 RealMatrix initCenters = gaussians.
centers();
57 RealVector initWidth = gaussians.
gamma();
60 for(
unsigned step = 0; step != numberOfSteps; ++step){
61 optimizer.
step(error);
66 std::cout<<
"center solutions"<<std::endl;
67 std::cout<<
"init:"<<initCenters<<std::endl;
68 std::cout<<
"after optimization:"<<gaussians.
centers()<<std::endl;
69 std::cout<<
"width solutions"<<std::endl;
70 std::cout<<
"init:"<<initWidth<<std::endl;
71 std::cout<<
"after optimization:"<<gaussians.
gamma()<<std::endl;