本文整理汇总了C++中DataCollector::log_experiment方法的典型用法代码示例。如果您正苦于以下问题:C++ DataCollector::log_experiment方法的具体用法?C++ DataCollector::log_experiment怎么用?C++ DataCollector::log_experiment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataCollector
的用法示例。
在下文中一共展示了DataCollector::log_experiment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void Experiment::run( DataCollector& dc, RandomNumberGenerator& rng )
{
// INITIALIZE
double prob_learning_type; // ELITE or BEST OF GENERATION
int i;
for( int run = 0; run < config->number_of_runs; run++ )
{
std::cout << "" << (run+1) << ",";
std::cout.flush();
dc.start_new_run( run );
prob_learning_type = 1.;
dc.run << "Run seed = " << rng.getCurrentSeed() << endline;
//INITIALIZE THE MODEL
Model model;
model.set_data_collector( dc );
// RUN FOR N GENERATIONS
for( i = 0; i < config->number_of_generations; i++ )
{
//std::cout << (run+1) << "." << i << "," << std::flush;
// ELITIST LEARNING
if( config->structural_learning == PIPE
&& prob_learning_type < config->pipe_prob_elitist_learn )
{
model.is_elitist_learning = true;
model.adapt( model.get_elite() );
}
else
{
// BEST OF LEARNING
// GENERATION BASED LEARNING
model.sample( rng );
if( config->fitness_test == RETINA_SWITCHING
&& ( i % config->retina_switch_after ) == 0
&& i != 0 )
retina_test_switch();
// MEASURE FITNESS + INDEX BEST and ELITE
model.measure_fitness( dc.run );
// ADAPT PPC TOWARD BEST
model.adapt( model.get_best() );
}
// MUTATE
model.mutate( rng );
prob_learning_type = rng.getRandom();
dc.log_generation( run, i, model );
dc.flush_debug();
if( ( model.stop_condition_met() && config->stop_on_target_reached )
|| ( i + 1 ) == config->number_of_generations )
{
dc.log_run( run, i, model );
break;
}
}
// RANDOM FITNESS TEST (to confirm findings)
dc.log_random_fitness( model );
}
dc.log_experiment();
}