Design Model Configs (🧪Beta)
albert.collections.design_model_configs.DesignModelConfigCollection
Bases: BaseCollection
Manage Design Model Configs in the Albert platform (🧪 Beta).
A design model config says how a design run models a smart dataset: which targets to predict (its outputs), how to transform each one, and which of the default features each one uses.
A config is created as a draft, edited with builder operations, checked against a smart dataset, and published. A published config is frozen; editing one means forking it into a new draft. Publishing validates and freezes; it trains nothing.
This collection is accessed as client.design_model_configs.
Beta Feature!
Please do not use in production or without explicit guidance from Albert. You might otherwise have a bad experience. This feature currently falls outside of the Albert support contract, but we'd love your feedback!
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
str
|
The base API route for design-model-config requests. |
Methods:
| Name | Description |
|---|---|
create |
Create a draft design model config, empty or derived from a smart dataset. |
get_by_id |
Get a single design model config by its ID. |
get_all |
Get all design model configs in a project. |
update |
Update the name or description of a draft design model config. |
apply |
Apply builder operations to a draft design model config. |
check_compatibility |
Check a design model config against a smart dataset. |
get_resolved_features |
Get the features a config resolves to against a smart dataset. |
get_feature_values |
Preview a few dataset rows run through the config's features. |
publish |
Publish a draft design model config, freezing it. |
fork |
Fork a published design model config into a new editable draft. |
get_references |
Get what references a component of a design model config. |
delete |
Delete a design model config by its ID. |
Source code in src/albert/collections/design_model_configs.py
create
create(
*,
name: str,
parent_id: ProjectId,
description: str | None = None,
smart_dataset_id: SmartDatasetId | None = None,
) -> DesignModelConfigCreated
Create a draft design model config.
Pass smart_dataset_id to derive the draft from a smart dataset: one bare
output per target, with no feature masks. Omit it to start empty and add outputs
with
apply.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Display name of the config. |
required |
parent_id
|
ProjectId
|
The project (format |
required |
description
|
str
|
Free-text description of the config's intent. |
None
|
smart_dataset_id
|
SmartDatasetId
|
Smart dataset (format |
None
|
Returns:
| Type | Description |
|---|---|
DesignModelConfigCreated
|
The created draft design model config, with any |
Source code in src/albert/collections/design_model_configs.py
get_by_id
get_by_id(*, id: DesignModelConfigId) -> DesignModelConfig
Get a single design model config by its ID.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
DesignModelConfigId
|
The design model config ID (format |
required |
Returns:
| Type | Description |
|---|---|
DesignModelConfig
|
The fully populated design model config. |
Source code in src/albert/collections/design_model_configs.py
get_all
get_all(
*,
parent_id: ProjectId,
state: DesignModelConfigState | None = None,
max_items: int | None = None,
) -> Iterator[DesignModelConfig]
Get all design model configs in a project.
Results are returned as a lazily paginated iterator.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent_id
|
ProjectId
|
The project (format |
required |
state
|
DesignModelConfigState
|
Limit to drafts or to published configs. |
None
|
max_items
|
int
|
Stop after this many configs. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[DesignModelConfig]
|
A lazily paginated iterator over the project's design model configs. |
Source code in src/albert/collections/design_model_configs.py
update
update(
*, design_model_config: DesignModelConfig
) -> DesignModelConfig
Update the name or description of a draft design model config.
Retrieve the config with
get_by_id,
modify name and/or description, then pass it here. Only changed fields
are applied. Outputs are edited with
apply.
A published config is frozen and cannot be updated;
fork
it into a new draft instead.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
design_model_config
|
DesignModelConfig
|
The config carrying the desired changes. Its |
required |
Returns:
| Type | Description |
|---|---|
DesignModelConfig
|
The updated design model config. |
Notes
The following fields can be updated: name, description.
Source code in src/albert/collections/design_model_configs.py
apply
apply(
*,
id: DesignModelConfigId,
operations: list[DesignModelConfigOperation],
validate: bool = False,
resolve: bool = False,
preview_rows: PreviewCount | None = None,
preview_max_columns: PreviewCount | None = None,
dry_run: bool = False,
smart_dataset_id: SmartDatasetId | None = None,
) -> DesignModelConfigApplyResponse
Apply builder operations to a draft design model config.
Operations apply atomically and in the order given: if any one cannot apply, nothing is applied and the call fails with the violations listed. The three operations:
SetOutputOperation: upsert one target's whole wiring (data type, transform and feature mask).RemoveComponentOperation: remove an output by its path,outputs/<target id>.UpdateComponentOperation: change one field of an output in place (for exampleoutputTransform).
A transform other than none on a categorical output is rejected
(invalid_settings), and fields the service does not accept are rejected
(invalid_constraint).
resolve and preview_rows need smart_dataset_id (the call fails
otherwise). With validate, a dataset adds the dataset checks to the
structural ones; without one, validate runs the structural checks only.
Example
from albert.resources.design_model_configs import (
FeatureMask,
OutputEntry,
SetOutputOperation,
)
from albert.resources.design_operands import IngredientAmountOperand
result = client.design_model_configs.apply(
id="DMC123",
operations=[
SetOutputOperation(
key="TAR046",
value=OutputEntry(
data_type="numeric",
features=FeatureMask(
exclude=[IngredientAmountOperand(ingredient="INV009")]
),
),
)
],
validate=True,
resolve=True,
smart_dataset_id="SDT123",
)
result.validation.valid
# True
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
DesignModelConfigId
|
The design model config ID (format |
required |
operations
|
list[DesignModelConfigOperation]
|
The operations to apply, in order. |
required |
validate
|
bool
|
Fold a check into the result. An invalid outcome is a normal result with
|
False
|
resolve
|
bool
|
Fold the resolved features into the result. Needs |
False
|
preview_rows
|
int or all
|
Fold a feature preview of this many dataset rows into the result ( |
None
|
preview_max_columns
|
int or all
|
Keyed feature columns whose values the folded preview returns ( |
None
|
dry_run
|
bool
|
Compute the would-be result without saving it. |
False
|
smart_dataset_id
|
SmartDatasetId
|
Smart dataset (format |
None
|
Returns:
| Type | Description |
|---|---|
DesignModelConfigApplyResponse
|
The resulting design model config ( |
Raises:
| Type | Description |
|---|---|
AlbertClientError
|
An operation could not apply (the violations are listed), |
AlbertHTTPError
|
Other failures. |
Source code in src/albert/collections/design_model_configs.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | |
check_compatibility
check_compatibility(
*,
id: DesignModelConfigId,
smart_dataset_id: SmartDatasetId,
) -> DesignModelConfigValidationResponse
Check a design model config against a smart dataset.
valid=False with populated violations is a normal result, not an
exception.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
DesignModelConfigId
|
The design model config ID (format |
required |
smart_dataset_id
|
SmartDatasetId
|
Smart dataset (format |
required |
Returns:
| Type | Description |
|---|---|
DesignModelConfigValidationResponse
|
The result with |
Source code in src/albert/collections/design_model_configs.py
get_resolved_features
get_resolved_features(
*,
id: DesignModelConfigId,
smart_dataset_id: SmartDatasetId,
) -> DesignModelConfigResolvedFeatures
Get the features a config resolves to against a smart dataset.
Returns every concrete feature (with a stable key, its family and the
quantity it computes) and, per output, the keys of the features that output's
mask routes.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
DesignModelConfigId
|
The design model config ID (format |
required |
smart_dataset_id
|
SmartDatasetId
|
Smart dataset (format |
required |
Returns:
| Type | Description |
|---|---|
DesignModelConfigResolvedFeatures
|
The resolved feature set, per-output routing and warnings. |
Source code in src/albert/collections/design_model_configs.py
get_feature_values
get_feature_values(
*,
id: DesignModelConfigId,
smart_dataset_id: SmartDatasetId,
num_rows: PreviewCount | None = None,
max_columns: PreviewCount | None = None,
) -> DesignModelConfigFeaturePreview
Preview dataset rows run through the config's features.
Every dataset row is featurized with the config's resolved features; no model is
fit. rows carry the first num_rows rows (rows_truncated says when) and
the first max_columns keyed feature columns (columns_truncated says when),
while summary covers every keyed feature over every row.
Features without a stable key (for example molecular descriptors) are always
used and are reported under automatic_features, not as values.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
DesignModelConfigId
|
The design model config ID (format |
required |
smart_dataset_id
|
SmartDatasetId
|
Smart dataset (format |
required |
num_rows
|
int or all
|
Rows to return; |
None
|
max_columns
|
int or all
|
Keyed feature columns whose values are returned; |
None
|
Returns:
| Type | Description |
|---|---|
DesignModelConfigFeaturePreview
|
The previewed rows, per-feature summary and automatic features. |
Source code in src/albert/collections/design_model_configs.py
publish
publish(*, id: DesignModelConfigId) -> DesignModelConfig
Publish a draft design model config, freezing it.
The config is validated first, without a dataset: one with blocking violations
cannot be published, and an already-published config conflicts. Publishing trains
nothing. Published configs are immutable; to change one,
fork
it into a new draft.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
DesignModelConfigId
|
The design model config ID (format |
required |
Returns:
| Type | Description |
|---|---|
DesignModelConfig
|
The published design model config. |
Raises:
| Type | Description |
|---|---|
AlbertClientError
|
The config has blocking violations (they are listed) or is already published. |
AlbertHTTPError
|
Other failures. |
Source code in src/albert/collections/design_model_configs.py
fork
fork(
*,
id: DesignModelConfigId,
parent_id: ProjectId | None = None,
) -> DesignModelConfig
Fork a published design model config into a new editable draft.
The new draft remembers which published config it came from
(forked_from_id). Forking a draft conflicts; only published configs can be
forked.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
DesignModelConfigId
|
The published design model config ID (format |
required |
parent_id
|
ProjectId
|
Target project (format |
None
|
Returns:
| Type | Description |
|---|---|
DesignModelConfig
|
The new draft design model config. |
Source code in src/albert/collections/design_model_configs.py
get_references
get_references(
*, id: DesignModelConfigId, component: str
) -> DesignModelConfigReferences
Get what references a component of a design model config.
Powers safe removal: check whether anything still points at the component
before removing it with
apply.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
DesignModelConfigId
|
The design model config ID (format |
required |
component
|
str
|
Component path, |
required |
Returns:
| Type | Description |
|---|---|
DesignModelConfigReferences
|
The references to the component. |
Source code in src/albert/collections/design_model_configs.py
delete
delete(*, id: DesignModelConfigId) -> None
Delete a design model config by its ID.
A published config that a design run still references cannot be deleted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
DesignModelConfigId
|
The design model config ID (format |
required |
Returns:
| Type | Description |
|---|---|
None
|
|