Commit 5c331b84 authored by André Anjos's avatar André Anjos 💬
Browse files

Merge branch '6-change-required-after-bob-bio-base-command-line-option-change' into 'master'

Resolve "Change required after bob.bio.base command-line option change"

Closes #6 

@andre.anjos : Does this look OK to you?

See merge request !1
parents 9825a51c 0e45af28
Pipeline #4207 passed with stages
in 68 minutes and 21 seconds
......@@ -58,6 +58,13 @@ def parse_arguments(command_line_parameters, exclude_resources_from = []):
if tools.base(args.algorithm).__class__ not in (algorithm.GMM, algorithm.GMMRegular):
raise ValueError("The given algorithm %s is not a (pure) GMM algorithm" % type(args.algorithm))
# check if one of the parameters is given wothout the sub-task
if args.sub_task is None:
if args.iteration is not None: raise ValueError("The option --iteration is an internal option and cannot be used to define experiments")
if args.model_type is not None: raise ValueError("The option --model-type is an internal option and cannot be used to define experiments")
if args.score_type is not None: raise ValueError("The option --score-type is an internal option and cannot be used to define experiments")
if args.group is not None: raise ValueError("The option --group is an internal option and cannot be used to define experiments; did you mean to use --groups?")
return args
def add_gmm_jobs(args, job_ids, deps, submitter):
......
......@@ -58,6 +58,13 @@ def parse_arguments(command_line_parameters, exclude_resources_from = []):
if tools.base(args.algorithm).__class__ != algorithm.ISV:
raise ValueError("The given algorithm %s is not a (pure) ISV algorithm" % type(args.algorithm))
# check if one of the parameters is given wothout the sub-task
if args.sub_task is None:
if args.iteration is not None: raise ValueError("The option --iteration is an internal option and cannot be used to define experiments")
if args.model_type is not None: raise ValueError("The option --model-type is an internal option and cannot be used to define experiments")
if args.score_type is not None: raise ValueError("The option --score-type is an internal option and cannot be used to define experiments")
if args.group is not None: raise ValueError("The option --group is an internal option and cannot be used to define experiments; did you mean to use --groups?")
return args
from .verify_gmm import add_gmm_jobs
......
......@@ -58,6 +58,13 @@ def parse_arguments(command_line_parameters, exclude_resources_from = []):
if tools.base(args.algorithm).__class__ != algorithm.IVector:
raise ValueError("The given algorithm %s is not a (pure) IVector algorithm" % type(args.algorithm))
# check if one of the parameters is given wothout the sub-task
if args.sub_task is None:
if args.iteration is not None: raise ValueError("The option --iteration is an internal option and cannot be used to define experiments")
if args.model_type is not None: raise ValueError("The option --model-type is an internal option and cannot be used to define experiments")
if args.score_type is not None: raise ValueError("The option --score-type is an internal option and cannot be used to define experiments")
if args.group is not None: raise ValueError("The option --group is an internal option and cannot be used to define experiments; did you mean to use --groups?")
return args
from .verify_gmm import add_gmm_jobs
......
from __future__ import print_function
import bob.measure
import os
import shutil
import tempfile
import numpy
import nose
import bob.io.image
import bob.bio.base
......@@ -75,8 +74,6 @@ def test_gmm_sequential():
'--preferred-package', 'bob.bio.gmm'
]
print (bob.bio.base.tools.command_line(parameters))
_verify(parameters, test_dir, 'test_gmm_sequential', ref_modifier='-gmm')
......@@ -100,8 +97,6 @@ def test_gmm_parallel():
'--preferred-package', 'bob.bio.gmm'
]
print (bob.bio.base.tools.command_line(parameters))
_verify(parameters, test_dir, 'test_gmm_parallel', executable=main, ref_modifier='-gmm')
......@@ -120,8 +115,6 @@ def test_isv_sequential():
'--preferred-package', 'bob.bio.gmm'
]
print (bob.bio.base.tools.command_line(parameters))
_verify(parameters, test_dir, 'test_isv_sequential', ref_modifier='-isv')
......@@ -145,8 +138,6 @@ def test_isv_parallel():
'--preferred-package', 'bob.bio.gmm'
]
print (bob.bio.base.tools.command_line(parameters))
_verify(parameters, test_dir, 'test_isv_parallel', executable=main, ref_modifier='-isv')
......@@ -164,7 +155,7 @@ def test_ivector_cosine_sequential():
'--result-directory', test_dir,
'--preferred-package', 'bob.bio.gmm'
]
print (bob.bio.base.tools.command_line(parameters))
_verify(parameters, test_dir, 'test_ivector_cosine_sequential', ref_modifier='-ivector-cosine')
......@@ -187,7 +178,7 @@ def test_ivector_cosine_parallel():
'--result-directory', test_dir,
'--preferred-package', 'bob.bio.gmm'
]
print (bob.bio.base.tools.command_line(parameters))
_verify(parameters, test_dir, 'test_ivector_cosine_parallel', executable=main, ref_modifier='-ivector-cosine')
def test_ivector_lda_wccn_plda_sequential():
......@@ -203,7 +194,7 @@ def test_ivector_lda_wccn_plda_sequential():
'--temp-directory', test_dir,
'--result-directory', test_dir
]
print (bob.bio.base.tools.command_line(parameters))
_verify(parameters, test_dir, 'test_ivector_lda_wccn_plda_sequential', ref_modifier='-ivector-lda-wccn-plda')
......@@ -226,5 +217,39 @@ def test_ivector_lda_wccn_plda_parallel():
'--result-directory', test_dir,
'--preferred-package', 'bob.bio.gmm'
]
print (bob.bio.base.tools.command_line(parameters))
_verify(parameters, test_dir, 'test_ivector_lda_wccn_plda_parallel', executable=main, ref_modifier='-ivector-lda-wccn-plda')
def test_internal_raises():
test_dir = tempfile.mkdtemp(prefix='bobtest_')
test_database = os.path.join(test_dir, "submitted.sql3")
# define dummy parameters
parameters = [
'-d', 'dummy',
'-p', 'dummy',
'-e', 'dummy2d',
'-g', 'bob.bio.base.grid.Grid(grid_type = "local", number_of_parallel_processes = 2, scheduler_sleep_time = 0.1)', '-G', test_database, '--run-local-scheduler', '--stop-on-failure',
'--import', 'bob.bio.gmm', 'bob.io.image',
'--clean-intermediate',
'--zt-norm',
'-vs', 'test_raises',
'--temp-directory', test_dir,
'--result-directory', test_dir,
'--preferred-package', 'bob.bio.gmm'
]
from bob.bio.gmm.script.verify_gmm import main as gmm
from bob.bio.gmm.script.verify_isv import main as isv
from bob.bio.gmm.script.verify_ivector import main as ivector
for script, algorithm in (
(gmm, "bob.bio.gmm.algorithm.GMM(2, 2, 2)"),
(isv, "bob.bio.gmm.algorithm.ISV(10, number_of_gaussians=2, kmeans_training_iterations=2, gmm_training_iterations=2, isv_training_iterations=2)"),
(ivector, "bob.bio.gmm.algorithm.IVector(10, number_of_gaussians=2, kmeans_training_iterations=2, gmm_training_iterations=2, tv_training_iterations=2, use_lda=True, use_wccn=True, use_plda=True, lda_dim=2, plda_dim_F=2, plda_dim_G=2, plda_training_iterations=2)")):
for option, value in (("--iteration", "0"), ("--group", "dev"), ("--model-type", "N"), ("--score-type", "A")):
internal = parameters + ["--algorithm", algorithm, option, value]
nose.tools.assert_raises(ValueError, script, internal)
shutil.rmtree(test_dir)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment