Пример #1
0
 def test_experiment_statistics(self):
     '''Test methods that return statistics of a genotype set.'''
     fraction = 0.3
     experiment = v.Experiment(self.problem, fraction)
     assert_equal(experiment.total_called, 0, 'Wrong # of initially-called genotypes')
     assert_equal(experiment.total_errors, 0, 'Wrong # of genotype call errors')
     experiment.run(main_phaser())
     assert_almost_equal(experiment.fraction, fraction, 3, 'Wrong fraction of deleted genotypes')
     plots.plot_experiment_stats(experiment)
Пример #2
0
 def test_parametric_experiment(self):
     '''Test running a validation experiment on a phaser for an array of deleted genotype
     fraction values.'''
     # Make sure g has no missing data, easier to check change in g after clearing portion in that case
     num_experiments = 3
     fraction = np.linspace(0.01, 0.05, num_experiments).astype(np.float32) #+1e-5 # TODO: change to log scale spacing?
     results = v.parametric_experiment(self.problem, fraction, main_phaser(), verbose=False)
     assert_equal(results.shape, [num_experiments], 'Wrong result array size')
     assert_equal(results['deleted_fraction'], fraction, 'Wrong result record')
     plots.plot_parametric_experiment(results, print_stats=False)