Hyperparameter Searches

See here for additional information regarding hyperparameter searches.

class SpellClient.hyper
class HyperService(client)

An object for managing Spell hyperparameter searches.

get(search_id)

Fetch an existing hyper search by ID.

Parameters

search_id (int) – the ID of the hyper search to fetch

list()

List hyperparameter searches on Spell.

Returns

A list of HyperSearchInfo objects

archive(search_id)

Archives a hyperparameter search by ID.

Parameters

search_id (int) – the ID of the hyper search to archive

Create a hyperparameter grid search.

Parameters
  • params (dict of str -> ValueSpec) – hyperparameter specifications for the run. A run will be created for all hyperparameter value combinations provided. Each key of the dict should appear in the command argument surrounded by colons.

  • **kwargs – all keyword arguments for a new run are accepted here. See new.

Returns

A HyperSearch object

Raises

ClientException – an error occured.

Create a hyperparameter random search.

Parameters
  • params (dict of str -> ValueSpec or RangeSpec) – hyperparameter specifications for the run. num_runs runs will be created and each hyperparameter specified will be sampled to determine a specific value for each run. Each key of the dict should appear in the command argument surrounded by colons.

  • num_runs (int) – the number of runs to create in this hyperparameter search

  • **kwargs – all keyword arguments for a new run are accepted here. See new.

Returns

A HyperSearch object

Raises

ClientException – an error occured.

Create a hyperparameter bayesian search.

Parameters
  • params (dict of str -> RangeSpec) – hyperparameter specifications for the run. num_runs runs will be created and each hyperparameter specified will be sampled to determine a specific value for each run. Each key of the dict should appear in the command argument surrounded by colons.

  • num_runs (int) – the number of runs to create in this hyperparameter search

  • parallel_runs (int) – the number of parallel runs to use for each iteration

  • metric (string) – the name of the metric that we want to optimize

  • metric_agg (string) – the metric aggregation function to use for optimization

  • **kwargs – all keyword arguments for a new run are accepted here. See new.

Returns

A HyperSearch object

Raises

ClientException – an error occured.

LINEAR = 'linear'

a constant for the “linear” hyperparameter scaling

Type

str

LOG = 'log'

a constant for the “log” hyperparameter scaling

Type

str

REVERSE_LOG = 'reverse_log'

a constant for the “reverse_log” hyperparameter scaling

Type

str

FLOAT = 'float'

a constant for the “float” hyperparameter type

Type

str

INT = 'int'

a constant for the “int” hyperparameter type

Type

str

HyperSearch

class HyperSearch

An object representing a hyperparameter search.

id

the hyperparameter search id

Type

int

runs

the runs created by the hyperparameter search

Type

list of Run

kill()

Kill the hyperparameter search.

Raises

ClientException – an error occured.

metric_names()

Enumerate metrics associated with this hyperparameter search.

Raises

ClientException – an error occured.

metrics(metric_name)

Get a hyperparameter search metric.

Parameters

metric_name (str) – the name of the metric being fetched.

Raises

ClientException – an error occured.

refresh()

Refresh the hyperparameter search state.

Refresh all of the hyperparameter search attributes with the latest information for the hyperparameter search from Spell.

Raises

ClientException – an error occured.

stop()

Stop the hyperparameter search.

Raises

ClientException – an error occured.

RangeSpec

class RangeSpec(min, max, scaling='linear', type='float')

A range parameter specification for hyperparameter search

min

the minimum value for the hyperparameter range

Type

int or float

max

the maximum value for the hyperparameter range

Type

int or float

scaling

the scaling for the hyperparameter. Allowed values are LINEAR, LOG, REVERSE_LOG

Type

str, optional

type

the type for the hyperparameter. Allowed values are INT, FLOAT

Type

str, optional

ValueSpec

class ValueSpec(values)

A value parameter specification for hyperparameter search

values

discrete values for this hyperparameter.

Type

list of float, int, or str