ConfigFactory

class imagepypelines.core.ml.ConfigFactory(*arg_trials, **kwarg_trials)[source]

Bases: object

argument Permuter object for generating permutations of function arguments or configurations for config files

For example, in many machine learning applications, parameters have to be tweaked frequently to optimize a model. This can be a tedious task and frequently involves a human tweaking configurations files. This object is meant to simplify that process by generating permutations from a sample of arguments and keyword arguments

Example

>>> import imagepypelines as ip
>>> def run_important_test(arg1,arg2,arg3,first,second,third):
...    # real code will do something
...    pass
>>> arg_trials = [
...        [1,2,3], # trials for first positional argument
...        ['a','b','c'], # trials for second positional arguments
...        ['y','z'], # trials for third positional argument
...        ]
>>> kwarg_trials = {
...            'first':None, # trials for 'first' keyword argument
...            'second':['I','J','K'], # trials for 'second' keyword argument
...            'third':['i','j','k'], # trials for 'third' keyword argument
...            }
>>> permuter = ip.ml.ConfigFactory(*arg_trials,**kwarg_trials)
>>> for args,kwargs in permuter:
...    run_important_test(*args,**kwargs)

Methods Summary

remaining() returns the number of remaining permutations

Methods Documentation

remaining()[source]

returns the number of remaining permutations