netpyne.batchtools.search module
- netpyne.batchtools.search.ray_optuna_search(...)[source]
- Parameters:
dispatcher_constructor (Callable, # constructor for the dispatcher (e.g. INETDispatcher))
submit_constructor (Callable, # constructor for the submit (e.g. SHubmitSOCK))
run_config (Dict, # batch configuration, (keyword: string pairs to customize the submit template))
params (Dict, # search space (dictionary of parameter keys: tune search spaces))
label (Optional[str] = 'optuna_search', # label for the search)
output_path (Optional[str] = '../batch', # directory for storing generated files)
checkpoint_path (Optional[str] = '../ray', # directory for storing checkpoint files)
max_concurrent (Optional[int] = 1, # number of concurrent trials to run at one time)
batch (Optional[bool] = True, # whether concurrent trials should run synchronously or asynchronously)
num_samples (Optional[int] = 1, # number of trials to run)
metric (Optional[str] = "loss", # metric to optimize (this should match some key: value pair in the returned data)
mode (Optional[str] = "min", # either 'min' or 'max' (whether to minimize or maximize the metric)
optuna_config (Optional[dict] = None, # additional configuration for the optuna search algorithm (incl. sampler, seed, etc.))
Creates
-------
<label>.csv (file containing the results of the search)
- Returns:
Study
- Return type:
namedtuple(‘Study’, [‘algo’, ‘results’])(algo, results), # named tuple containing the created algorithm and the results of the search
- netpyne.batchtools.search.ray_search(dispatcher_constructor: Callable, submit_constructor: Callable, run_config: Dict, params: Dict, algorithm: str | None = 'variant_generator', label: str | None = 'search', output_path: str | None = '../batch', checkpoint_path: str | None = '../ray', max_concurrent: int | None = 1, batch: bool | None = True, num_samples: int | None = 1, metric: str | None = 'loss', mode: str | None = 'min', algorithm_config: dict | None = None) ResultGrid [source]
- class netpyne.batchtools.search.constructors(dispatcher, submit)
Bases:
tuple
- dispatcher
Alias for field number 0
- submit
Alias for field number 1
- netpyne.batchtools.search.constructor_tuples = {('sge', 'sfs'): (<class 'batchtk.runtk.dispatchers.SFSDispatcher'>, <class 'batchtk.runtk.submits.SGESubmitSFS'>), ('sge', 'socket'): (<class 'batchtk.runtk.dispatchers.INETDispatcher'>, <class 'batchtk.runtk.submits.SGESubmitSOCK'>), ('sh', 'sfs'): (<class 'batchtk.runtk.dispatchers.SFSDispatcher'>, <class 'batchtk.runtk.submits.SHSubmitSFS'>), ('sh', 'socket'): (<class 'batchtk.runtk.dispatchers.UNIXDispatcher'>, <class 'batchtk.runtk.submits.SHSubmitSOCK'>)}
some shim functions before ray_search
- netpyne.batchtools.search.generate_constructors(job_type, comm_type='socket', **kwargs)[source]
” returns the dispatcher, submit constructor pair for ray_search based on the job_type and comm_type inputs
- netpyne.batchtools.search.generate_parameters(params, algorithm, **kwargs)[source]
- Parameters:
{'synMechTau2' (params =) – #’synMechTau2’: [3.0, 7.0], # assumes lower/upper bounds by default if evol-like algo ‘connWeight’ : paramtypes.sample_from(lambda _: numpy.random.uniform(0.005, 0.15))} # can optionally pass any of the paramtypes (= ray.tune data types)
- Return type:
a dictionary of parameters for ray_search based on the input dictionary
- netpyne.batchtools.search.shim(job_type: str, comm_type: str, run_config: Dict, params: Dict, algorithm: str | None = 'variant_generator', label: str | None = 'search', output_path: str | None = '../batch', checkpoint_path: str | None = '../ray', max_concurrent: int | None = 1, batch: bool | None = True, num_samples: int | None = 1, metric: str | None = 'loss', mode: str | None = 'min', algorithm_config: dict | None = None)[source]
- netpyne.batchtools.search.search(...)[source]
- Parameters:
job_type (str, # the submission engine to run a single simulation (e.g. 'sge', 'sh'))
comm_type (str, # the method of communication between host dispatcher and the simulation (e.g. 'socket', 'filesystem'))
run_config (Dict, # batch configuration, (keyword: string pairs to customize the submit template))
params (Dict, # search space (dictionary of parameter keys: tune search spaces))
algorithm (Optional[str] = "variant_generator", # search algorithm to use, see SEARCH_ALG_IMPORT for available options)
label (Optional[str] = 'search', # label for the search)
output_path (Optional[str] = '../batch', # directory for storing generated files)
checkpoint_path (Optional[str] = '../ray', # directory for storing checkpoint files)
max_concurrent (Optional[int] = 1, # number of concurrent trials to run at one time)
batch (Optional[bool] = True, # whether concurrent trials should run synchronously or asynchronously)
num_samples (Optional[int] = 1, # number of trials to run)
metric (Optional[str] = "loss", # metric to optimize (this should match some key: value pair in the returned data)
mode (Optional[str] = "min", # either 'min' or 'max' (whether to minimize or maximize the metric)
algorithm_config (Optional[dict] = None, # additional configuration for the search algorithm)
Creates
-------
<label>.csv (file containing the results of the search)
- Returns:
ResultGrid
- Return type:
tune.ResultGrid # results of the search