def test_testset(self, patch): call = 'autosklearn.cli.SMAC_interface test %s ' \ '1000000 0 -1 %s' % \ (self.dataset_string, self.param_string) sys.argv = shlex.split(call) SMAC_interface.main() self.assertEqual(patch.call_count, 1) call_args, call_kwargs = patch.call_args self.assertEqual(call_args, (self.dataset_string, 'test', 1, self.params)) self.assertEqual(call_kwargs, {'mode_args': None})
def test_nested_cv(self, patch): call = 'autosklearn.cli.SMAC_interface nested-cv:3/3 %s ' \ '1000000 0 -1 %s' % \ (self.dataset_string, self.param_string) sys.argv = shlex.split(call) SMAC_interface.main() self.assertEqual(patch.call_count, 1) call_args, call_kwargs = patch.call_args self.assertEqual(call_args, (self.dataset_string, 'nested-cv', 1, self.params)) self.assertEqual(call_kwargs, {'mode_args': {'outer_folds': 3, 'inner_folds': 3}})
def test_holdout(self, patch): call = 'autosklearn.cli.SMAC_interface holdout %s ' \ '1000000 0 -1 %s' % \ (self.dataset_string, self.param_string) sys.argv = shlex.split(call) SMAC_interface.main(output_dir=self.output_directory) self.assertEqual(patch.call_count, 1) call_args, call_kwargs = patch.call_args self.assertEqual(call_args, (self.dataset_string, 'holdout', 1, self.params)) self.assertEqual(call_kwargs, {'mode_args': None, 'output_dir': self.output_directory})
def test_partial_cv(self, patch): for fold in range(3): call = 'autosklearn.cli.SMAC_interface partial-cv:%d/3 %s ' \ '1000000 0 -1 %s' % \ (fold, self.dataset_string, self.param_string) sys.argv = shlex.split(call) SMAC_interface.main() self.assertEqual(patch.call_count, fold + 1) call_args, call_kwargs = patch.call_args self.assertEqual(call_args, (self.dataset_string, 'partial-cv', 1, self.params)) self.assertEqual(call_kwargs, {'mode_args': {'folds': 3, 'fold': fold}})
def test_holdout(self, patch): call = 'autosklearn.cli.SMAC_interface holdout %s ' \ '1000000 0 -1 %s' % \ (self.dataset_string, self.param_string) sys.argv = shlex.split(call) SMAC_interface.main(output_dir=self.output_directory) self.assertEqual(patch.call_count, 1) call_args, call_kwargs = patch.call_args self.assertEqual(call_args, (self.dataset_string, 'holdout', 1, self.params)) self.assertEqual(call_kwargs, { 'mode_args': None, 'output_dir': self.output_directory })
def test_nested_cv(self, patch): call = 'autosklearn.cli.SMAC_interface nested-cv:3/3 %s ' \ '1000000 0 -1 %s' % \ (self.dataset_string, self.param_string) sys.argv = shlex.split(call) SMAC_interface.main() self.assertEqual(patch.call_count, 1) call_args, call_kwargs = patch.call_args self.assertEqual(call_args, (self.dataset_string, 'nested-cv', 1, self.params)) self.assertEqual(call_kwargs, {'mode_args': { 'outer_folds': 3, 'inner_folds': 3 }})
def test_partial_cv(self, patch): for fold in range(3): call = 'autosklearn.cli.SMAC_interface partial-cv:%d/3 %s ' \ '1000000 0 -1 %s' % \ (fold, self.dataset_string, self.param_string) sys.argv = shlex.split(call) SMAC_interface.main() self.assertEqual(patch.call_count, fold + 1) call_args, call_kwargs = patch.call_args self.assertEqual( call_args, (self.dataset_string, 'partial-cv', 1, self.params)) self.assertEqual(call_kwargs, {'mode_args': { 'folds': 3, 'fold': fold }})