Breakthrough Model
albert.collections.btmodel.BTModelSessionCollection
Bases: BaseCollection
Manage Breakthrough model sessions in the Albert platform.
Albert Breakthrough is Albert's inverse-design / ML optimization capability. A model session
(BTModelSession) is the parent record that
groups a related set of trained models produced in a single modeling run. Each
session is built from a dataset (BTDataset),
identified by dataset_id (format DST...), and the individual models it
contains are managed through
BTModelCollection.
Model sessions are identified by a model session ID (format MDS..., e.g.
"MDS12").
This collection is accessed as client.btmodelsessions.
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 model session requests. |
Methods:
| Name | Description |
|---|---|
create |
Create a new model session. |
get_by_id |
Get a single model session by its ID. |
update |
Update an existing model session. |
delete |
Delete a model session by its ID. |
Source code in src/albert/collections/btmodel.py
create
create(*, model_session: BTModelSession) -> BTModelSession
Create a new model session.
A session groups the models produced from a single dataset. Set
dataset_id to the BTDataset the
session is built from, and category to indicate whether it is a
user-built or Albert-built session.
Example
from albert import Albert
from albert.resources.btmodel import BTModelSession, BTModelSessionCategory
client = Albert()
session = BTModelSession(
name="Tensile strength study",
category=BTModelSessionCategory.USER_MODEL,
dataset_id="DST1",
)
created = client.btmodelsessions.create(model_session=session)
created.id
# 'MDS12'
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_session
|
BTModelSession
|
The session to create. |
required |
Returns:
| Type | Description |
|---|---|
BTModelSession
|
The newly created session, populated with its assigned ID. |
Source code in src/albert/collections/btmodel.py
get_by_id
get_by_id(*, id: BTModelSessionId) -> BTModelSession
Get a single model session by its ID.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
BTModelSessionId
|
The model session ID (format |
required |
Returns:
| Type | Description |
|---|---|
BTModelSession
|
The fully populated model session. |
Source code in src/albert/collections/btmodel.py
update
update(*, model_session: BTModelSession) -> BTModelSession
Update an existing model session.
Fetch the session (e.g. with get_by_id), modify the updatable
fields on the returned object, then pass it here. Only the fields listed
in Notes are applied; changes to other fields are ignored.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_session
|
BTModelSession
|
The session to update. Must have a valid |
required |
Returns:
| Type | Description |
|---|---|
BTModelSession
|
The updated session. |
Notes
The following fields can be updated: flag, name, registry.
Source code in src/albert/collections/btmodel.py
delete
delete(*, id: BTModelSessionId) -> None
Delete a model session by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
BTModelSessionId
|
The model session ID to delete (format |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/albert/collections/btmodel.py
albert.collections.btmodel.BTModelCollection
Bases: BaseCollection
Manage individual Breakthrough models in the Albert platform.
Albert Breakthrough is Albert's inverse-design / ML optimization capability. A model
(BTModel) is a single trained model. A model
can either belong to a parent model session
(BTModelSession), in which case its
parent_id is the session ID, or be detached (standalone, with no parent
session). Most methods here take an optional parent_id: pass the session ID
to operate on a model within that session, or omit it to operate on a detached
model.
Models are identified by a model ID (format MDL..., e.g. "MDL34").
This collection is accessed as client.btmodels.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Methods:
| Name | Description |
|---|---|
create |
Create a new model, optionally within a parent session. |
get_by_id |
Get a single model by its ID. |
update |
Update an existing model. |
delete |
Delete a model by its ID. |
Source code in src/albert/collections/btmodel.py
create
create(
*,
model: BTModel,
parent_id: BTModelSessionId | None = None,
) -> BTModel
Create a new model.
Pass parent_id to create the model inside an existing session
(BTModelSession); omit it to create a
detached, standalone model.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
BTModel
|
The model to create. |
required |
parent_id
|
BTModelSessionId
|
The parent session ID (format |
None
|
Returns:
| Type | Description |
|---|---|
BTModel
|
The newly created model, populated with its assigned ID. |
Notes
Only name is required on a BTModel.
dataset_id and target are optional on the model, but in practice
they are provided together with state.
Source code in src/albert/collections/btmodel.py
get_by_id
get_by_id(
*,
id: BTModelId,
parent_id: BTModelSessionId | None = None,
) -> BTModel
Get a single model by its ID.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
BTModelId
|
The model ID (format |
required |
parent_id
|
BTModelSessionId
|
The parent session ID (format |
None
|
Returns:
| Type | Description |
|---|---|
BTModel
|
The fully populated model. |
Source code in src/albert/collections/btmodel.py
update
update(
*,
model: BTModel,
parent_id: BTModelSessionId | None = None,
) -> BTModel
Update an existing model.
Fetch the model (e.g. with get_by_id), modify the updatable fields
on the returned object, then pass it here. Only the fields listed in Notes
are applied; changes to other fields are ignored.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
BTModel
|
The model to update. Must have a valid |
required |
parent_id
|
BTModelSessionId
|
The parent session ID (format |
None
|
Returns:
| Type | Description |
|---|---|
BTModel
|
The updated model. |
Notes
The following fields can be updated: end_time, metadata,
model_binary_key, name, start_time, state, target,
total_time, type.
Source code in src/albert/collections/btmodel.py
delete
delete(
*,
id: BTModelId,
parent_id: BTModelSessionId | None = None,
) -> None
Delete a model by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
BTModelId
|
The model ID to delete (format |
required |
parent_id
|
BTModelSessionId
|
The parent session ID (format |
None
|
Returns:
| Type | Description |
|---|---|
None
|
|