citrine.resources.design_space module

Resources that represent collections of design spaces.

class citrine.resources.design_space.DefaultDesignSpaceMode(value)

Bases: BaseEnumeration

The type of default design space to create.

  • ATTRIBUTE results in a product design space containing dimensions required by the predictor

  • HIERARCHICAL results in a hierarchical design space resembling the shape of training data

ATTRIBUTE = 'ATTRIBUTE'
HIERARCHICAL = 'HIERARCHICAL'
class citrine.resources.design_space.DesignSpaceCollection(project_id: UUID, session: Session)

Bases: Collection[DesignSpace]

Represents the collection of design spaces as well as the resources belonging to it.

Parameters:

project_id (UUID) – the UUID of the project

archive(uid: UUID | str) DesignSpace

Archiving a design space removes it from view, but is not a hard delete.

Parameters:

uid (Union[UUID, str]) – Unique identifier of the design space to archive

build(data: dict) DesignSpace

Build an individual design space.

convert_to_hierarchical(uid: UUID | str, *, predictor_id: UUID | str, predictor_version: int | str | None = None) HierarchicalDesignSpace

Convert an existing ProductDesignSpace into an equivalent HierarchicalDesignSpace.

A ProductDesignSpace can be mapped to a HierarchicalDesignSpace by using the associated predictor and its training data to infer the shape of the hierarchical design space. Constraints are then transferred from the product design space to the appropriate node in the hierarchical design space.

Parameters:
  • uid (Union[str, UUID]) – UUID of the existing product design space to convert to a hierarchical version

  • predictor_id (Union[UUID, str]) – UUID of a predictor associated with the design space.

  • predictor_version (Optional[Union[int, str]]) – Version of the predictor to use. Defaults to the most recent version.

Returns:

  • A HierarchicalDesignSpace modeled on the

  • existing ProductDesignSpace.

create_default(*, predictor_id: UUID, predictor_version: int | str | None = None, mode: DefaultDesignSpaceMode = DefaultDesignSpaceMode.ATTRIBUTE, include_ingredient_fraction_constraints: bool = False, include_label_fraction_constraints: bool = False, include_label_count_constraints: bool = False, include_parameter_constraints: bool = False) DesignSpace

Create a default design space for a predictor.

This method will return an unregistered design space for all inputs that are not responses of the predictor. The design space will contain a FormulationDesignSpace for each formulation input. Dimensions are constructed for all other inputs. A ContinuousDimension is constructed for each input that corresponds to a RealDescriptor. An EnumeratedDimension is constructed for all other inputs. Enumerated values taken from the allowed categories of a CategoricalDescriptor or from the unique values from the training data for all other descriptors.

Parameters:
  • predictor_id (UUID) – UUID of the predictor used to construct the design space

  • predictor_version (Optional[Union[int, str]]) – Version of the predictor used to construct the design space

  • mode (DefaultDesignSpaceMode) – The type of default design space to produce. Defaults to DefaultDesignSpaceMode.ATTRIBUTE.

  • include_ingredient_fraction_constraints (bool) – Whether to include constraints on ingredient fractions based on the training data. Defaults to False.

  • include_label_fraction_constraints (bool) – Whether to include constraints on label fractions based on the training data. Defaults to False.

  • include_label_count_constraints (bool) – Whether to include constraints on labeled ingredient counts based on the training data. Defaults to False.

  • include_parameter_constraints (bool) – Whether to include constraints on all other inputs based on the training data. Defaults to False.

Returns:

Default design space

Return type:

DesignSpace

delete(uid: UUID | str)

Design Spaces cannot be deleted at this time.

get(uid: UUID | str) ResourceType

Get a particular element of the collection.

list(*, per_page: int = 20) Iterable[DesignSpace]

List the most recent version of all non-archived design spaces.

list_all(*, per_page: int = 20) Iterable[DesignSpace]

List the most recent version of all design spaces.

list_archived(*, per_page: int = 20) Iterable[DesignSpace]

List the most recent version of all archived predictors.

register(design_space: DesignSpace) DesignSpace

Create a new design space.

restore(uid: UUID | str) DesignSpace

Restore an archived design space.

Parameters:

uid (Union[UUID, str]) – Unique identifier of the design space to restore

update(design_space: DesignSpace) DesignSpace

Update and validate an existing DesignSpace.