+ test_cov_parameters.py: script to execute the estimator testor (t-EstimatorNormalMulti) in using all combinaison parameters values for 2-D cov-matrix
This commit is contained in:
parent
e70464630e
commit
7845ba50c7
3 changed files with 130 additions and 36 deletions
|
|
@ -1,3 +1,5 @@
|
|||
#include <sstream>
|
||||
|
||||
#include <eo>
|
||||
#include <mo>
|
||||
|
||||
|
|
@ -33,6 +35,7 @@ int main(int ac, char** av)
|
|||
AtomType covar2_value = parser.createParam((AtomType)0.5, "covar2", "Covar value 2", '2', section).value();
|
||||
AtomType covar3_value = parser.createParam((AtomType)1, "covar3", "Covar value 3", '3', section).value();
|
||||
|
||||
|
||||
if (parser.userNeedsHelp())
|
||||
{
|
||||
parser.printHelp(std::cout);
|
||||
|
|
@ -86,26 +89,37 @@ int main(int ac, char** av)
|
|||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// (3) distribution output
|
||||
// (3a) distribution output preparation
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
doDummyContinue< Distrib >* dummy_continue = new doDummyContinue< Distrib >();
|
||||
state.storeFunctor(dummy_continue);
|
||||
doDummyContinue< Distrib >* distrib_dummy_continue = new doDummyContinue< Distrib >();
|
||||
state.storeFunctor(distrib_dummy_continue);
|
||||
|
||||
doCheckPoint< Distrib >* distribution_continue = new doCheckPoint< Distrib >( *dummy_continue );
|
||||
state.storeFunctor(distribution_continue);
|
||||
doCheckPoint< Distrib >* distrib_continue = new doCheckPoint< Distrib >( *distrib_dummy_continue );
|
||||
state.storeFunctor(distrib_continue);
|
||||
|
||||
doDistribStat< Distrib >* distrib_stat = new doStatNormalMulti< EOT >();
|
||||
state.storeFunctor(distrib_stat);
|
||||
|
||||
distribution_continue->add( *distrib_stat );
|
||||
distrib_continue->add( *distrib_stat );
|
||||
|
||||
eoMonitor* stdout_monitor = new eoStdoutMonitor();
|
||||
state.storeFunctor(stdout_monitor);
|
||||
stdout_monitor->add(*distrib_stat);
|
||||
distribution_continue->add( *stdout_monitor );
|
||||
std::ostringstream ss;
|
||||
ss << p_size << "_" << mean_value << "_" << covar1_value << "_"
|
||||
<< covar2_value << "_" << covar3_value << "_gen";
|
||||
|
||||
(*distribution_continue)( distrib );
|
||||
doFileSnapshot* distrib_file_snapshot = new doFileSnapshot("TestResDistrib", 1, ss.str());
|
||||
state.storeFunctor(distrib_file_snapshot);
|
||||
distrib_file_snapshot->add(*distrib_stat);
|
||||
distrib_continue->add(*distrib_file_snapshot);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// (3b) distribution output
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
(*distrib_continue)( distrib );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -154,20 +168,20 @@ int main(int ac, char** av)
|
|||
// (5) population output
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
eoContinue< EOT >* cont = new eoGenContinue< EOT >( 2 ); // never reached fitness
|
||||
state.storeFunctor(cont);
|
||||
eoContinue< EOT >* pop_cont = new eoGenContinue< EOT >( 2 ); // never reached fitness
|
||||
state.storeFunctor(pop_cont);
|
||||
|
||||
eoCheckPoint< EOT >* pop_continue = new eoCheckPoint< EOT >( *cont );
|
||||
eoCheckPoint< EOT >* pop_continue = new eoCheckPoint< EOT >( *pop_cont );
|
||||
state.storeFunctor(pop_continue);
|
||||
|
||||
doPopStat< EOT >* popStat = new doPopStat<EOT>;
|
||||
state.storeFunctor(popStat);
|
||||
pop_continue->add(*popStat);
|
||||
doPopStat< EOT >* pop_stat = new doPopStat<EOT>;
|
||||
state.storeFunctor(pop_stat);
|
||||
pop_continue->add(*pop_stat);
|
||||
|
||||
doFileSnapshot* fileSnapshot = new doFileSnapshot("TestResPop");
|
||||
state.storeFunctor(fileSnapshot);
|
||||
fileSnapshot->add(*popStat);
|
||||
pop_continue->add(*fileSnapshot);
|
||||
doFileSnapshot* pop_file_snapshot = new doFileSnapshot("TestResPop");
|
||||
state.storeFunctor(pop_file_snapshot);
|
||||
pop_file_snapshot->add(*pop_stat);
|
||||
pop_continue->add(*pop_file_snapshot);
|
||||
|
||||
(*pop_continue)( pop );
|
||||
|
||||
|
|
@ -190,7 +204,7 @@ int main(int ac, char** av)
|
|||
// (7) distribution output
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
(*distribution_continue)( distrib );
|
||||
(*distrib_continue)( distrib );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
17
test/test_cov_parameters.py
Executable file
17
test/test_cov_parameters.py
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
PSIZE = 10000
|
||||
MEAN = 0
|
||||
CMD = "./test/t-doEstimatorNormalMulti -P=%s -m=%.1f -1=%.1f -2=%.1f -3=%.1f && ./gplot.py -r TestResPop -p -w 5 -u -g %s -G results_for_test_cov_parameters"
|
||||
|
||||
from os import system
|
||||
from numpy import arange
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
for p1 in list(arange(0.1, 1.1, 0.1)):
|
||||
for p2 in list(arange(-1., 0., 0.1)) + list(arange(0., 1.1, 0.1)):
|
||||
for p3 in list(arange(0.1, 1.1, 0.1)):
|
||||
cmd = CMD % ( PSIZE, MEAN, p1, p2, p3, '%d_%.1f_%.1f_%.1f_%.1f' % (PSIZE, MEAN, p1, p2, p3) )
|
||||
print cmd
|
||||
system( cmd )
|
||||
Reference in a new issue