adorn.unit.search.grid module

Objects that enable grid searching adorn configs

class adorn.unit.search.grid.BaseGrid(keys, values)

Bases: adorn.unit.search.grid.GridElement

Generate a dict to be added to the search space for each value

Parameters
  • keys (Union[str, List[str]]) – name(s) to assign to each search value

  • values (List[Any]) – collection of values to search over

Return type

None

class adorn.unit.search.grid.BaseGridSearch(search_space)

Bases: adorn.unit.search.grid.GridSearch

Generate a search space by taking the itertools.product of other search spaces and components

Parameters

search_space (List[Union[GridElement, GridSearch]]) – collection of grid objects to be composed

Return type

None

class adorn.unit.search.grid.FileGridSearch(filenames)

Bases: adorn.unit.search.grid.GridSearch

A grid search space made of a collection of adorn configs

Parameters

filenames (List[str]) – location of the adorn configs on disk

Return type

None

class adorn.unit.search.grid.GridElement

Bases: adorn.unit.search.search.SearchElement

Individual component that make up a space to search over

Return type

None

static str_to_list(str_or_list)

Convert a string to a list

Parameters

str_or_list (Union[str, List[str]]) – a string to be converted to a list or a list that will have nothing done to it

Returns

a string that has been promoted to a list or just

the original list that was passed

Return type

List[str]

class adorn.unit.search.grid.GridElementTemplate

Bases: adorn.unit.search.grid.GridElement, adorn.unit.template.Template

A Template for components of a grid search

Return type

None

class adorn.unit.search.grid.GridList(grid_search, organize=None)

Bases: adorn.unit.search.grid.GridOrchestrator[List[adorn.params.Params]]

Generate a grid search space and optionally alter the order of the space

Parameters
  • grid_search (GridSearch) – specification of a grid search space

  • organize (Optional[Organize]) – optionally alter the order of a search space, if None the order is not altered

Return type

None

class adorn.unit.search.grid.GridNestedList(grid_search, group=None)

Bases: adorn.unit.search.grid.GridOrchestrator[List[List[adorn.params.Params]]]

Generate a collection of grid search spaces

Parameters
  • grid_search (GridSearch) – specification of a grid search space

  • group (Optional[Group]) – optional specification of how to create grid search spaces, if None each element in the grid search becomes its own grid search space

Return type

None

class adorn.unit.search.grid.GridOrchestrator

Bases: adorn.unit.complex.Complex, Generic[adorn.unit.search.grid.GRID_OUTPUT]

Generate a grid search space and optionally alter the space

Return type

None

constructor_name: Optional[str] = '__init__'

Name of the constructor to use to instantiate the class

class adorn.unit.search.grid.GridSearch

Bases: adorn.unit.search.search.SearchSpace

Generate a grid search space by composing multiple grid components

Return type

None

static tuple_to_dict(tpl)

Convert a tuple of dictionaries to a single dictionary

Parameters

tpl (Tuple[Dict[str, Any], ...]) – collection of dictionaries

Returns

a dictionary made of all the dictionaries

passed to this method

Return type

Dict[str, Any]

class adorn.unit.search.grid.Group

Bases: adorn.unit.complex.Complex

Partition a list of grid points based on shared characteristics

Return type

None

class adorn.unit.search.grid.GroupBy(keys)

Bases: adorn.unit.search.grid.Group

Partition a list of grid points based on common values

Parameters

keys (Union[str, List[str]]) – names of the values to group the grid elements by

Return type

None

class adorn.unit.search.grid.IDGroup

Bases: adorn.unit.search.grid.Group

Add each element of a list of grid points to its own partition

Return type

None

class adorn.unit.search.grid.IDOrganize

Bases: adorn.unit.search.grid.Organize

Perform no alterations to the list of grid points

Return type

None

class adorn.unit.search.grid.IdGrid(keys, value)

Bases: adorn.unit.search.grid.GridElementTemplate

Add a single value to a grid search

This is useful when you want to override a value for a given search space

Parameters
  • keys (Union[str, List[str]]) –

  • value (Any) –

Return type

None

class adorn.unit.search.grid.ListGridSearch(search_space)

Bases: adorn.unit.search.grid.GridSearch

Concatenate grid search spaces to create a single search space

Parameters

search_space (List[GridSearch]) – multiple search spaces to be concatenated

Return type

None

class adorn.unit.search.grid.Organize

Bases: adorn.unit.complex.Complex

Alter the order of a list of grid points

Return type

None

class adorn.unit.search.grid.SortOrganize(keys)

Bases: adorn.unit.search.grid.Organize

Sort a list of grid points based on the values contained in each element

Parameters

keys (Union[str, List[str]]) – names of the values to sort the values of a list

Return type

None

generate_key(dct)

Get the values associated with a grid point for sorting

Parameters

dct (Dict[str, Any]) – the grid point, which will have values parsed from it

Returns

values from a grid point to be used for sorting

Return type

Union[Any, Tuple[Any, …]]