See also: synthesis_task reference.
The synthesis task serves to synthesise patterns from a pattern model.
#include <ame/patterns/task/synthesis.hpp> #include <ame/patterns/model/chain_hmm.hpp> #include <ame/observations/generation/normal.hpp> #include <ame/observations/training/normal.hpp> #include <boost/assign/std/vector.hpp> #define BOOST_TEST_MAIN #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_CASE( test ) { ame::patterns::synthesis_task < ame::patterns::model::chain_hmm<ame::observations::normal>, ame::patterns::expectation_maximization_training > task; std::vector<std::vector<double> > examples(2); using namespace boost::assign; examples.front() += 0, 1.1; examples.back() += 0.1, 1.2; task.add_pattern_with_examples(2, examples); std::vector<double> synthesized; task.synthesize(synthesized); BOOST_CHECK_EQUAL(synthesized.size(), 2u); task.synthesize(synthesized); BOOST_CHECK_EQUAL(synthesized.size(), 2u); task.reset(); for(int i=0; i<4; i++) task.generate(); BOOST_CHECK_EQUAL(task.generators().front().current_vertex(), 2u); }