Blueprints
Blueprint
- class datarobot.models.Blueprint
A Blueprint which can be used to fit models
- Variables:
id (
str
) – the id of the blueprintprocesses (
List[str]
) – the processes used by the blueprintmodel_type (
str
) – the model produced by the blueprintproject_id (
str
) – the project the blueprint belongs toblueprint_category (
str
) – (New in version v2.6) Describes the category of the blueprint and the kind of model it produces.recommended_featurelist_id (
str
ornull
) – (New in v2.18) The ID of the feature list recommended for this blueprint. If this field is not present, then there is no recommended feature list.supports_composable_ml (
bool
orNone
) – (New in version v2.26) whether this blueprint is supported in the Composable ML.supports_incremental_learning (
bool
orNone
) – (New in version v3.3) whether this blueprint supports incremental learning.
- classmethod get(project_id, blueprint_id)
Retrieve a blueprint.
- Parameters:
project_id (
str
) – The project’s id.blueprint_id (
str
) – Id of blueprint to retrieve.
- Returns:
blueprint – The queried blueprint.
- Return type:
- get_json()
Get the blueprint json representation used by this model.
- Returns:
Json representation of the blueprint stages.
- Return type:
BlueprintJson
- get_chart()
Retrieve a chart.
- Returns:
The current blueprint chart.
- Return type:
- get_documents()
Get documentation for tasks used in the blueprint.
- Returns:
All documents available for blueprint.
- Return type:
list
ofBlueprintTaskDocument
- classmethod from_data(data)
Instantiate an object of this class using a dict.
- Parameters:
data (
dict
) – Correctly snake_cased keys and their values.- Return type:
TypeVar
(T
, bound= APIObject)
- classmethod from_server_data(data, keep_attrs=None)
Instantiate an object of this class using the data directly from the server, meaning that the keys may have the wrong camel casing
- Parameters:
data (
dict
) – The directly translated dict of JSON from the server. No casing fixes have taken placekeep_attrs (
iterable
) – List, set or tuple of the dotted namespace notations for attributes to keep within the object structure even if their values are None
- Return type:
TypeVar
(T
, bound= APIObject)
- class datarobot.models.BlueprintTaskDocument
Document describing a task from a blueprint.
- Variables:
title (
str
) – Title of document.task (
str
) – Name of the task described in document.description (
str
) – Task description.parameters (
list
ofdict(name
,type
,description)
) – Parameters that task can receive in human-readable format.links (
list
ofdict(name
,url)
) – External links used in documentreferences (
list
ofdict(name
,url)
) – References used in document. When no link available url equals None.
- class datarobot.models.BlueprintChart
A Blueprint chart that can be used to understand data flow in blueprint.
- Variables:
nodes (
list
ofdict (id
,label)
) – Chart nodes, id unique in chart.edges (
list
oftuple (id1
,id2)
) – Directions of data flow between blueprint chart nodes.
- classmethod get(project_id, blueprint_id)
Retrieve a blueprint chart.
- Parameters:
project_id (
str
) – The project’s id.blueprint_id (
str
) – Id of blueprint to retrieve chart.
- Returns:
The queried blueprint chart.
- Return type:
- to_graphviz()
Get blueprint chart in graphviz DOT format.
- Returns:
String representation of chart in graphviz DOT language.
- Return type:
unicode
- class datarobot.models.ModelBlueprintChart
A Blueprint chart that can be used to understand data flow in model. Model blueprint chart represents reduced repository blueprint chart with only elements that used to build this particular model.
- Variables:
nodes (
list
ofdict (id
,label)
) – Chart nodes, id unique in chart.edges (
list
oftuple (id1
,id2)
) – Directions of data flow between blueprint chart nodes.
- classmethod get(project_id, model_id)
Retrieve a model blueprint chart.
- Parameters:
project_id (
str
) – The project’s id.model_id (
str
) – Id of model to retrieve model blueprint chart.
- Returns:
The queried model blueprint chart.
- Return type:
- to_graphviz()
Get blueprint chart in graphviz DOT format.
- Returns:
String representation of chart in graphviz DOT language.
- Return type:
unicode
User blueprints
- class datarobot.UserBlueprint
A representation of a blueprint which may be modified by the user, saved to a user’s AI Catalog, trained on projects, and shared with others.
It is recommended to install the python library called
datarobot_bp_workshop
, available viapip
, for the best experience when building blueprints.Please refer to
http://blueprint-workshop.datarobot.com
for tutorials, examples, and other documentation.- Parameters:
blender (
bool
) – Whether the blueprint is a blender.blueprint_id (
string
) – The deterministic id of the blueprint, based on its content.custom_task_version_metadata (
list[list[string]]
,Optional
) – An association of custom entity ids and task ids.diagram (
string
) – The diagram used by the UI to display the blueprint.features (
list[string]
) – A list of the names of tasks used in the blueprint.features_text (
string
) – A description of the blueprint via the names of tasks used.hex_column_name_lookup (
list[UserBlueprintsHexColumnNameLookupEntry]
,Optional
) – A lookup between hex values and data column names used in the blueprint.icons (
list[int]
) – The icon(s) associated with the blueprint.insights (
string
) – An indication of the insights generated by the blueprint.is_time_series (
bool (Default=False)
) – Whether the blueprint contains time-series tasks.model_type (
string
) – The generated or provided title of the blueprint.project_id (
string
,Optional
) – The id of the project the blueprint was originally created with, if applicable.reference_model (
bool (Default=False)
) – Whether the blueprint is a reference model.shap_support (
bool (Default=False)
) – Whether the blueprint supports shapley additive explanations.supported_target_types (
list[enum(``
’binary’, ``'multiclass'
,'multilabel'
,'nonnegative'
,
)'regression' – The list of supported targets of the current blueprint.
'unsupervised' – The list of supported targets of the current blueprint.
'unsupervisedclustering')] – The list of supported targets of the current blueprint.
supports_gpu (
bool (Default=False)
) – Whether the blueprint supports execution on the GPU.user_blueprint_id (
string
) – The unique id associated with the user blueprint.user_id (
string
) – The id of the user who owns the blueprint.blueprint (
list[dict]
orlist[UserBlueprintTask]
,Optional
) – The representation of a directed acyclic graph defining a pipeline of data through tasks and a final estimator.vertex_context (
list[VertexContextItem]
,Optional
) – Info about, warnings about, and errors with a specific vertex in the blueprint.blueprint_context (
VertexContextItemMessages
) – Warnings and errors which may describe or summarize warnings or errors in the blueprint’s vertices
- classmethod list(limit=100, offset=0, project_id=None)
Fetch a list of the user blueprints the current user created
- Parameters:
limit (
int (Default=100)
) – The max number of results to return.offset (
int (Default=0)
) – The number of results to skip (for pagination).project_id (
string
,Optional
) – The id of the project, used to filter for original project_id.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
list[UserBlueprint]
- classmethod get(user_blueprint_id, project_id=None)
Retrieve a user blueprint
- Parameters:
user_blueprint_id (
string
) – Used to identify a specific user-owned blueprint.project_id (
string (optional
, defaultis None)
) – String representation of ObjectId for a given project. Used to validate selected columns in the user blueprint.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
- classmethod create(blueprint, model_type=None, project_id=None, save_to_catalog=True)
Create a user blueprint
- Parameters:
blueprint (
list[dict]
orlist[UserBlueprintTask]
) – A list of tasks in the form of dictionaries which define a blueprint.model_type (
string
,Optional
) – The title to give to the blueprint.project_id (
string
,Optional
) – The project associated with the blueprint. Necessary in the event of project specific tasks, such as column selection tasks.save_to_catalog (
bool
,(Default=True)
) – Whether the blueprint being created should be saved to the catalog.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
- classmethod create_from_custom_task_version_id(custom_task_version_id, save_to_catalog=True, description=None)
Create a user blueprint with a single custom task version
- Parameters:
custom_task_version_id (
string
) – Id of custom task version from which the user blueprint is createdsave_to_catalog (
bool
,(Default=True)
) – Whether the blueprint being created should be saved to the catalogdescription (
string (Default=None)
) – The description for the user blueprint that will be created from the custom task version.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
- classmethod clone_project_blueprint(blueprint_id, project_id, model_type=None, save_to_catalog=True)
Clone a blueprint from a project.
- Parameters:
blueprint_id (
string
) – The id associated with the blueprint to create the user blueprint from.model_type (
string
,Optional
) – The title to give to the blueprint.project_id (
string
) – The id of the project which the blueprint to copy comes from.save_to_catalog (
bool
,(Default=True)
) – Whether the blueprint being created should be saved to the catalog.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
- classmethod clone_user_blueprint(user_blueprint_id, model_type=None, project_id=None, save_to_catalog=True)
Clone a user blueprint.
- Parameters:
model_type (
string
,Optional
) – The title to give to the blueprint.project_id (
string
,Optional
) – String representation of ObjectId for a given project. Used to validate selected columns in the user blueprint.user_blueprint_id (
string
) – The id of the existing user blueprint to copy.save_to_catalog (
bool
,(Default=True)
) – Whether the blueprint being created should be saved to the catalog.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
- classmethod update(blueprint, user_blueprint_id, model_type=None, project_id=None, include_project_id_if_none=False)
Update a user blueprint
- Parameters:
blueprint (
list(dict)
orlist(UserBlueprintTask)
) – A list of tasks in the form of dictionaries which define a blueprint. If None, will not be passed.model_type (
string
,Optional
) – The title to give to the blueprint. If None, will not be passed.project_id (
string
,Optional
) – The project associated with the blueprint. Necessary in the event of project specific tasks, such as column selection tasks. If None, will not be passed. To explicitly pass None, pass True to include_project_id_if_none (useful if unlinking a blueprint from a project)user_blueprint_id (
string
) – Used to identify a specific user-owned blueprint.include_project_id_if_none (
bool (Default=False)
) – Allows project_id to be passed as None, instead of ignored. If set to False, will not pass project_id in the API request if it is set to None. If True, the project id will be passed even if it is set to None.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
- classmethod delete(user_blueprint_id)
Delete a user blueprint, specified by the userBlueprintId.
- Parameters:
user_blueprint_id (
string
) – Used to identify a specific user-owned blueprint.- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
requests.models.Response
- classmethod get_input_types()
Retrieve the input types which can be used with User Blueprints.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
UserBlueprintAvailableInput
- classmethod add_to_project(project_id, user_blueprint_ids)
Add a list of user blueprints, by id, to a specified (by id) project’s repository.
- Parameters:
project_id (
string
) – The projectId of the project for the repository to add the specified user blueprints to.user_blueprint_ids (
list(string)
orstring
) – The ids of the user blueprints to add to the specified project’s repository.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
UserBlueprintAddToProjectMenu
- classmethod get_available_tasks(project_id=None, user_blueprint_id=None)
Retrieve the available tasks, organized into categories, which can be used to create or modify User Blueprints.
- Parameters:
project_id (
string
,Optional
)user_blueprint_id (
string
,Optional
)
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
UserBlueprintAvailableTasks
- classmethod validate_task_parameters(output_method, task_code, task_parameters, project_id=None)
Validate that each value assigned to specified task parameters are valid.
- Parameters:
output_method (
enum(``
’P’, ``'Pm'
,'S'
,'Sm'
,'T'
,'TS'
)
) – The method representing how the task will output data.task_code (
string
) – The task code representing the task to validate parameter values.task_parameters (
list(UserBlueprintTaskParameterValidationRequestParamItem)
) – A list of task parameters and proposed values to be validated.project_id (
string (optional
, defaultis None)
) – The projectId representing the project where this user blueprint is edited.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
UserBlueprintValidateTaskParameters
Get a list of users, groups and organizations that have an access to this user blueprint
- Parameters:
id (
Optional[str]
) – Only return the access control information for a organization, group or user with this ID.limit (
int (Default=100)
) – At most this many results are returned.name (
string
,Optional
) – Only return the access control information for a organization, group or user with this name.offset (
int (Default=0)
) – This many results will be skipped.share_recipient_type (
enum(``
’user’, ``'group'
,'organization'
)
,Optional
) – Describes the recipient type, either user, group, or organization.user_blueprint_id (
str
) – Used to identify a specific user-owned blueprint.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
list[UserBlueprintSharedRolesResponseValidator]
- classmethod validate_blueprint(blueprint, project_id=None)
Validate a user blueprint and return information about the inputs expected and outputs provided by each task.
- Parameters:
blueprint (
list(dict)
orlist(UserBlueprintTask)
) – The representation of a directed acyclic graph defining a pipeline of data through tasks and a final estimator.project_id (
string (optional
, defaultis None)
) – The projectId representing the project where this user blueprint is edited.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
list[VertexContextItem]
Share a user blueprint with a user, group, or organization
- Parameters:
user_blueprint_id (
str
) – Used to identify a specific user-owned blueprint.roles (
list(or(GrantAccessControlWithUsernameValidator
,GrantAccessControlWithIdValidator))
) – Array of GrantAccessControl objects., up to maximum 100 objects.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
requests.models.Response
- classmethod search_catalog(search=None, tag=None, limit=100, offset=0, owner_user_id=None, owner_username=None, order_by='-created')
Fetch a list of the user blueprint catalog entries the current user has access to based on an optional search term, tags, owner user info, or sort order.
- Parameters:
search (
string
,Optional.
) – A value to search for in the dataset’s name, description, tags, column names, categories, and latest error. The search is case insensitive. If no value is provided for this parameter, or if the empty string is used, or if the string contains only whitespace, no filtering will be done. Partial matching is performed on dataset name and description fields while all other fields will only match if the search matches the whole value exactly.tag (
string
,Optional.
) – If provided, the results will be filtered to include only items with the specified tag.limit (
int
,Optional. (default
:0)
,at most this many results are returned. To specify no
) – limit, use 0. The default may change and a maximum limit may be imposed without notice.offset (
int
,Optional. (default
:0)
,this many results will be skipped.
)owner_user_id (
string
,Optional.
) – Filter results to those owned by one or more owner identified by UID.owner_username (
string
, Optional.) – Filter results to those owned by one or more owner identified by username.order_by (
string
,Optional. Defaults
to'-created'
) – Sort order which will be applied to catalog list, valid options are “catalogName”, “originalName”, “description”, “created”, and “relevance”. For all options other than relevance, you may prefix the attribute name with a dash to sort in descending order. e.g. orderBy=’-catalogName’.
- Return type:
- class datarobot.models.user_blueprints.models.UserBlueprintAvailableInput
Retrieve the input types which can be used with User Blueprints.
- Parameters:
input_types (
list(UserBlueprintsInputType)
) – A list of associated pairs of an input types and their human-readable names.
- classmethod get_input_types()
Retrieve the input types which can be used with User Blueprints.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
- class datarobot.models.user_blueprints.models.UserBlueprintAddToProjectMenu
Add a list of user blueprints, by id, to a specified (by id) project’s repository.
- Parameters:
added_to_menu (
list(UserBlueprintAddedToMenuItem)
) – The list of userBlueprintId and blueprintId pairs representing blueprints successfully added to the project repository.not_added_to_menu (
list(UserBlueprintNotAddedToMenuItem)
) – The list of userBlueprintId and error message representing blueprints which failed to be added to the project repository.message (
string
) – A success message or a list of reasons why the list of blueprints could not be added to the project repository.
- classmethod add_to_project(project_id, user_blueprint_ids)
Add a list of user blueprints, by id, to a specified (by id) project’s repository.
- Parameters:
project_id (
string
) – The projectId of the project for the repository to add the specified user blueprints to.user_blueprint_ids (
list(string)
) – The ids of the user blueprints to add to the specified project’s repository.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
- class datarobot.models.user_blueprints.models.UserBlueprintAvailableTasks
Retrieve the available tasks, organized into categories, which can be used to create or modify User Blueprints.
- Parameters:
categories (
list(UserBlueprintTaskCategoryItem)
) – A list of the available task categories, sub-categories, and tasks.tasks (
list(UserBlueprintTaskLookupEntry)
) – A list of task codes and their task definitions.
- classmethod get_available_tasks(project_id=None, user_blueprint_id=None)
Retrieve the available tasks, organized into categories, which can be used to create or modify User Blueprints.
- Parameters:
project_id (
string
,Optional
)user_blueprint_id (
string
,Optional
)
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
- class datarobot.models.user_blueprints.models.UserBlueprintValidateTaskParameters
Validate that each value assigned to specified task parameters are valid.
- Parameters:
errors (
list(UserBlueprintsValidateTaskParameter)
) – A list of the task parameters, their proposed values, and messages describing why each is not valid.
- classmethod validate_task_parameters(output_method, task_code, task_parameters, project_id=None)
Validate that each value assigned to specified task parameters are valid.
- Parameters:
output_method (
enum(``
’P’, ``'Pm'
,'S'
,'Sm'
,'T'
,'TS'
)
) – The method representing how the task will output data.task_code (
string
) – The task code representing the task to validate parameter values.task_parameters (
list(UserBlueprintTaskParameterValidationRequestParamItem)
) – A list of task parameters and proposed values to be validated.project_id (
string (optional
, defaultis None)
) – The projectId representing the project where this user blueprint is edited.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
A list of SharedRoles objects.
- Parameters:
share_recipient_type (
enum(``
’user’, ``'group'
,'organization'
)
) – Describes the recipient type, either user, group, or organization.role (
str
,one
ofenum(``
’CONSUMER’, ``'EDITOR'
,'OWNER'
)
) – The role of the org/group/user on this dataset or “NO_ROLE” for removing access when used with route to modify access.id (
str
) – The ID of the recipient organization, group or user.name (
string
) – The name of the recipient organization, group or user.
- class datarobot.models.user_blueprints.models.VertexContextItem
Info about, warnings about, and errors with a specific vertex in the blueprint.
- Parameters:
task_id (
string
) – The id associated with a specific vertex in the blueprint.information (
VertexContextItemInfo
)messages (
VertexContextItemMessages
)
- class datarobot.models.user_blueprints.models.UserBlueprintCatalogSearch
An APIObject representing a user blueprint catalog entry the current user has access to based on an optional search term and/or tags.
- Parameters:
id (
str
) – The ID of the catalog entry linked to the user blueprint.catalog_name (
str
) – The name of the user blueprint.creator (
str
) – The name of the user that created the user blueprint.user_blueprint_id (
str
) – The ID of the user blueprint.description (
Optional[str] (Default=None)
) – The description of the user blueprint.last_modifier_name (
Optional[str] (Default=None)
) – The name of the user that last modified the user blueprint.
- classmethod search_catalog(search=None, tag=None, limit=100, offset=0, owner_user_id=None, owner_username=None, order_by='-created')
Fetch a list of the user blueprint catalog entries the current user has access to based on an optional search term, tags, owner user info, or sort order.
- Parameters:
search (
string
,Optional.
) – A value to search for in the dataset’s name, description, tags, column names, categories, and latest error. The search is case insensitive. If no value is provided for this parameter, or if the empty string is used, or if the string contains only whitespace, no filtering will be done. Partial matching is performed on dataset name and description fields while all other fields will only match if the search matches the whole value exactly.tag (
string
,Optional.
) – If provided, the results will be filtered to include only items with the specified tag.limit (
int
,Optional. (default
:0)
,at most this many results are returned. To specify no
) – limit, use 0. The default may change and a maximum limit may be imposed without notice.offset (
int
,Optional. (default
:0)
,this many results will be skipped.
)owner_user_id (
string
,Optional.
) – Filter results to those owned by one or more owner identified by UID.owner_username (
string
, Optional.) – Filter results to those owned by one or more owner identified by username.order_by (
string
,Optional. Defaults
to'-created'
) – Sort order which will be applied to catalog list, valid options are “catalogName”, “originalName”, “description”, “created”, and “relevance”. For all options other than relevance, you may prefix the attribute name with a dash to sort in descending order. e.g. orderBy=’-catalogName’.
- Return type:
Custom tasks
- class datarobot.CustomTask
A custom task. This can be in a partial state or a complete state. When the latest_version is None, the empty task has been initialized with some metadata. It is not yet use-able for actual training. Once the first CustomTaskVersion has been created, you can put the CustomTask in UserBlueprints to train Models in Projects
Added in version v2.26.
- Variables:
id (
str
) – id of the custom taskname (
str
) – name of the custom tasklanguage (
str
) – programming language of the custom task. Can be “python”, “r”, “java” or “other”description (
str
) – description of the custom tasktarget_type (
datarobot.enums.CUSTOM_TASK_TARGET_TYPE
) –the target type of the custom task. One of:
datarobot.enums.CUSTOM_TASK_TARGET_TYPE.BINARY
datarobot.enums.CUSTOM_TASK_TARGET_TYPE.REGRESSION
datarobot.enums.CUSTOM_TASK_TARGET_TYPE.MULTICLASS
datarobot.enums.CUSTOM_TASK_TARGET_TYPE.ANOMALY
datarobot.enums.CUSTOM_TASK_TARGET_TYPE.TRANSFORM
latest_version (
datarobot.CustomTaskVersion
orNone
) – latest version of the custom task if the task has a latest version. If the latest version is None, the custom task is not ready for use in user blueprints. You must create its first CustomTaskVersion before you can use the CustomTaskcreated_by (
str
) – The username of the user who created the custom task.updated_at (
str
) – An ISO-8601 formatted timestamp of when the custom task was updated.created_at (
str
) – ISO-8601 formatted timestamp of when the custom task was createdcalibrate_predictions (
bool
) – whether anomaly predictions should be calibrated to be between 0 and 1 by DR. only applies to custom estimators with target type datarobot.enums.CUSTOM_TASK_TARGET_TYPE.ANOMALY
- classmethod from_server_data(data, keep_attrs=None)
Instantiate an object of this class using the data directly from the server, meaning that the keys may have the wrong camel casing
- Parameters:
data (
dict
) – The directly translated dict of JSON from the server. No casing fixes have taken placekeep_attrs (
iterable
) – List, set or tuple of the dotted namespace notations for attributes to keep within the object structure even if their values are None
- Return type:
- classmethod list(order_by=None, search_for=None)
List custom tasks available to the user.
Added in version v2.26.
- Parameters:
search_for (
Optional[str]
) – string for filtering custom tasks - only tasks that contain the string in name or description will be returned. If not specified, all custom task will be returnedorder_by (
Optional[str]
) – property to sort custom tasks by. Supported properties are “created” and “updated”. Prefix the attribute name with a dash to sort in descending order, e.g. order_by=’-created’. By default, the order_by parameter is None which will result in custom tasks being returned in order of creation time descending
- Returns:
a list of custom tasks.
- Return type:
List[CustomTask]
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- classmethod get(custom_task_id)
Get custom task by id.
Added in version v2.26.
- Parameters:
custom_task_id (
str
) – id of the custom task- Returns:
retrieved custom task
- Return type:
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status.
datarobot.errors.ServerError – if the server responded with 5xx status.
- classmethod copy(custom_task_id)
Create a custom task by copying existing one.
Added in version v2.26.
- Parameters:
custom_task_id (
str
) – id of the custom task to copy- Return type:
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- classmethod create(name, target_type, language=None, description=None, calibrate_predictions=None, **kwargs)
Creates only the metadata for a custom task. This task will not be use-able until you have created a CustomTaskVersion attached to this task.
Added in version v2.26.
- Parameters:
name (
str
) – name of the custom tasktarget_type (
datarobot.enums.CUSTOM_TASK_TARGET_TYPE
) –the target typed based on the following values. Anything else will raise an error
datarobot.enums.CUSTOM_TASK_TARGET_TYPE.BINARY
datarobot.enums.CUSTOM_TASK_TARGET_TYPE.REGRESSION
datarobot.enums.CUSTOM_TASK_TARGET_TYPE.MULTICLASS
datarobot.enums.CUSTOM_TASK_TARGET_TYPE.ANOMALY
datarobot.enums.CUSTOM_TASK_TARGET_TYPE.TRANSFORM
language (
Optional[str]
) – programming language of the custom task. Can be “python”, “r”, “java” or “other”description (
Optional[str]
) – description of the custom taskcalibrate_predictions (
Optional[bool]
) – whether anomaly predictions should be calibrated to be between 0 and 1 by DR. if None, uses default value from DR app (True). only applies to custom estimators with target type datarobot.enums.CUSTOM_TASK_TARGET_TYPE.ANOMALY
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status.
datarobot.errors.ServerError – if the server responded with 5xx status.
- Return type:
- update(name=None, language=None, description=None, **kwargs)
Update custom task properties.
Added in version v2.26.
- Parameters:
name (
Optional[str]
) – new custom task namelanguage (
Optional[str]
) – new custom task programming languagedescription (
Optional[str]
) – new custom task description
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status.
datarobot.errors.ServerError – if the server responded with 5xx status.
- Return type:
None
- refresh()
Update custom task with the latest data from server. :rtype:
None
Added in version v2.26.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- delete()
Delete custom task. :rtype:
None
Added in version v2.26.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- download_latest_version(file_path)
Download the latest custom task version.
Added in version v2.26.
- Parameters:
file_path (
str
) – the full path of the target zip file- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status.
datarobot.errors.ServerError – if the server responded with 5xx status.
- Return type:
None
- get_access_list()
Retrieve access control settings of this custom task.
Added in version v2.27.
- Return type:
Update the access control settings of this custom task.
Added in version v2.27.
- Parameters:
access_list (
list
ofSharingAccess
) – A list of SharingAccess to update.- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- Return type:
None
Examples
Transfer access to the custom task from old_user@datarobot.com to new_user@datarobot.com
import datarobot as dr new_access = dr.SharingAccess(new_user@datarobot.com, dr.enums.SHARING_ROLE.OWNER, can_share=True) access_list = [dr.SharingAccess(old_user@datarobot.com, None), new_access] dr.CustomTask.get('custom-task-id').share(access_list)
- class datarobot.models.custom_task_version.CustomTaskFileItem
A file item attached to a DataRobot custom task version.
Added in version v2.26.
- Variables:
id (
str
) – id of the file itemfile_name (
str
) – name of the file itemfile_path (
str
) – path of the file itemfile_source (
str
) – source of the file itemcreated_at (
str
) – ISO-8601 formatted timestamp of when the version was created
- class datarobot.enums.CustomTaskOutboundNetworkPolicy
The way to set and view a CustomTaskVersions outbound network policy.
- class datarobot.CustomTaskVersion
A version of a DataRobot custom task.
Added in version v2.26.
- Variables:
id (
str
) – id of the custom task versioncustom_task_id (
str
) – id of the custom taskversion_minor (
int
) – a minor version number of custom task versionversion_major (
int
) – a major version number of custom task versionlabel (
str
) – short human readable string to label the versioncreated_at (
str
) – ISO-8601 formatted timestamp of when the version was createdis_frozen (
bool
) – a flag if the custom task version is frozenitems (
List[CustomTaskFileItem]
) – a list of file items attached to the custom task versiondescription (
Optional[str]
) – custom task version descriptionbase_environment_id (
Optional[str]
) – id of the environment to use with the taskbase_environment_version_id (
Optional[str]
) – id of the environment version to use with the taskdependencies (
List[CustomDependency]
) – the parsed dependencies of the custom task version if the version has a valid requirements.txt filerequired_metadata_values (
List[RequiredMetadataValue]
) – Additional parameters required by the execution environment. The required keys are defined by the fieldNames in the base environment’s requiredMetadataKeys.arguments (
List[UserBlueprintTaskArgument]
) – A list of custom task version arguments.outbound_network_policy (
CustomTaskOutboundNetworkPolicy
)
- classmethod from_server_data(data, keep_attrs=None)
Instantiate an object of this class using the data directly from the server, meaning that the keys may have the wrong camel casing
- Parameters:
data (
dict
) – The directly translated dict of JSON from the server. No casing fixes have taken placekeep_attrs (
iterable
) – List, set or tuple of the dotted namespace notations for attributes to keep within the object structure even if their values are None
- classmethod create_clean(custom_task_id, base_environment_id, maximum_memory=None, is_major_update=True, folder_path=None, required_metadata_values=None, outbound_network_policy=None)
Create a custom task version without files from previous versions.
Added in version v2.26.
- Parameters:
custom_task_id (
str
) – the id of the custom taskbase_environment_id (
str
) – the id of the base environment to use with the custom task versionmaximum_memory (
Optional[int]
) – A number in bytes about how much memory custom tasks’ inference containers can run with.is_major_update (
bool
) – If the current version is 2.3, True would set the new version at 3.0. False would set the new version at 2.4. Defaults to True.folder_path (
Optional[str]
) – The path to a folder containing files to be uploaded. Each file in the folder is uploaded under path relative to a folder path.required_metadata_values (
Optional[List[RequiredMetadataValue]]
) – Additional parameters required by the execution environment. The required keys are defined by the fieldNames in the base environment’s requiredMetadataKeys.outbound_network_policy (
Optional[CustomTaskOutboundNetworkPolicy]
) – You must enable custom task network access permissions to pass any value other than None! Specifies if you custom task version is able to make network calls. None will set the value to DataRobot’s default.
- Returns:
created custom task version
- Return type:
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- classmethod create_from_previous(custom_task_id, base_environment_id, maximum_memory=None, is_major_update=True, folder_path=None, files_to_delete=None, required_metadata_values=None, outbound_network_policy=None)
Create a custom task version containing files from a previous version.
Added in version v2.26.
- Parameters:
custom_task_id (
str
) – the id of the custom taskbase_environment_id (
str
) – the id of the base environment to use with the custom task versionmaximum_memory (
Optional[int]
) – A number in bytes about how much memory custom tasks’ inference containers can run with.is_major_update (
bool
) – If the current version is 2.3, True would set the new version at 3.0. False would set the new version at 2.4. Defaults to True.folder_path (
Optional[str]
) – The path to a folder containing files to be uploaded. Each file in the folder is uploaded under path relative to a folder path.files_to_delete (
Optional[List[str]]
) – the list of a file items ids to be deleted Example: [“5ea95f7a4024030aba48e4f9”, “5ea6b5da402403181895cc51”]required_metadata_values (
Optional[List[RequiredMetadataValue]]
) – Additional parameters required by the execution environment. The required keys are defined by the fieldNames in the base environment’s requiredMetadataKeys.outbound_network_policy (
Optional[CustomTaskOutboundNetworkPolicy]
) – You must enable custom task network access permissions to pass any value other than None! Specifies if you custom task version is able to make network calls. None will get the value from the previous version if you have the proper permissions or use DataRobot’s default.
- Returns:
created custom task version
- Return type:
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- classmethod list(custom_task_id)
List custom task versions.
Added in version v2.26.
- Parameters:
custom_task_id (
str
) – the id of the custom task- Returns:
a list of custom task versions
- Return type:
List[CustomTaskVersion]
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- classmethod get(custom_task_id, custom_task_version_id)
Get custom task version by id.
Added in version v2.26.
- Parameters:
custom_task_id (
str
) – the id of the custom taskcustom_task_version_id (
str
) – the id of the custom task version to retrieve
- Returns:
retrieved custom task version
- Return type:
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status.
datarobot.errors.ServerError – if the server responded with 5xx status.
- download(file_path)
Download custom task version.
Added in version v2.26.
- Parameters:
file_path (
str
) – path to create a file with custom task version content- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status.
datarobot.errors.ServerError – if the server responded with 5xx status.
- update(description=None, required_metadata_values=None)
Update custom task version properties.
Added in version v2.26.
- Parameters:
description (
str
) – new custom task version descriptionrequired_metadata_values (
List[RequiredMetadataValue]
) – Additional parameters required by the execution environment. The required keys are defined by the fieldNames in the base environment’s requiredMetadataKeys.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status.
datarobot.errors.ServerError – if the server responded with 5xx status.
- refresh()
Update custom task version with the latest data from server.
Added in version v2.26.
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- start_dependency_build()
Start the dependency build for a custom task version and return build status. .. versionadded:: v2.27
- Returns:
DTO of custom task version dependency build.
- Return type:
CustomTaskVersionDependencyBuild
- start_dependency_build_and_wait(max_wait)
Start the dependency build for a custom task version and wait while pulling status. .. versionadded:: v2.27
- Parameters:
max_wait (
int
) – max time to wait for a build completion- Returns:
DTO of custom task version dependency build.
- Return type:
CustomTaskVersionDependencyBuild
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
datarobot.errors.AsyncTimeoutError – Raised if the dependency build is not finished after max_wait.
- cancel_dependency_build()
Cancel custom task version dependency build that is in progress. .. versionadded:: v2.27
- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
- get_dependency_build()
Retrieve information about a custom task version’s dependency build. .. versionadded:: v2.27
- Returns:
DTO of custom task version dependency build.
- Return type:
CustomTaskVersionDependencyBuild
- download_dependency_build_log(file_directory='.')
Get log of a custom task version dependency build. .. versionadded:: v2.27
- Parameters:
file_directory (
str (optional
, default is"."
)
) – Directory path where downloaded file is to save.- Raises:
datarobot.errors.ClientError – if the server responded with 4xx status
datarobot.errors.ServerError – if the server responded with 5xx status
Visual AI
- class datarobot.models.visualai.images.Image
An image stored in a project’s dataset.
- Variables:
id (
str
) – Image ID for this image.image_type (
str
) – Image media type. Accessing this may require a server request and an associated delay in returning.image_bytes (
bytes
) – Raw bytes of this image. Accessing this may require a server request and an associated delay in returning.height (
int
) – Height of the image in pixels.width (
int
) – Width of the image in pixels.
- class datarobot.models.visualai.images.SampleImage
A sample image in a project’s dataset.
If
Project.stage
isdatarobot.enums.PROJECT_STAGE.EDA2
then thetarget_*
attributes of this class will have values, otherwise the values will all be None.- Variables:
image (
Image
) – Image object.target_value (
TargetValue
) – Value associated with thefeature_name
.project_id (
str
) – Id of the project that contains the images.
- classmethod list(project_id, feature_name, target_value=None, target_bin_start=None, target_bin_end=None, offset=None, limit=None)
Get sample images from a project.
- Parameters:
project_id (
str
) – Project that contains the images.feature_name (
str
) – Name of feature column that contains images.target_value (
TargetValue
) – For classification projects - target value to filter images. Please note that you can only use this parameter when the project has finished the EDA2 stage.target_bin_start (
Optional[Union[int
,float]]
) – For regression projects - only images corresponding to the target values above (inclusive) this value will be returned. Must be specified together with target_bin_end. Please note that you can only use this parameter when the project has finished the EDA2 stage.target_bin_end (
Optional[Union[int
,float]]
) – For regression projects - only images corresponding to the target values below (exclusive) this value will be returned. Must be specified together with target_bin_start. Please note that you can only use this parameter when the project has finished the EDA2 stage.offset (
Optional[int]
) – Number of images to be skipped.limit (
Optional[int]
) – Number of images to be returned.
- Return type:
List
[SampleImage
]
- class datarobot.models.visualai.images.DuplicateImage
An image that was duplicated in the project dataset.
- Variables:
image (
Image
) – Image object.count (
int
) – Number of times the image was duplicated.
- classmethod list(project_id, feature_name, offset=None, limit=None)
Get all duplicate images in a project.
- Parameters:
project_id (
str
) – Project that contains the images.feature_name (
str
) – Name of feature column that contains images.offset (
Optional[int]
) – Number of images to be skipped.limit (
Optional[int]
) – Number of images to be returned.
- Return type:
List
[DuplicateImage
]
- class datarobot.models.visualai.insights.ImageEmbedding
Vector representation of an image in an embedding space.
A vector in an embedding space will allow linear computations to be carried out between images: for example computing the Euclidean distance of the images.
- Variables:
image (
Image
) – Image object used to create this map.feature_name (
str
) – Name of the feature column this embedding is associated with.position_x (
int
) – X coordinate of the image in the embedding space.position_y (
int
) – Y coordinate of the image in the embedding space.actual_target_value (
object
) – Actual target value of the dataset row.target_values (
Optional[List[str]]
) – For classification projects, a list of target values of this project.target_bins (
Optional[List[Dict[str
,float]]]
) – For regression projects, a list of target bins of this project.project_id (
str
) – Id of the project this Image Embedding belongs to.model_id (
str
) – Id of the model this Image Embedding belongs to.
- classmethod compute(project_id, model_id)
Start the computation of image embeddings for the model.
- Parameters:
project_id (
str
) – Project to start creation in.model_id (
str
) – Project’s model to start creation in.
- Returns:
URL to check for image embeddings progress.
- Return type:
str
- Raises:
datarobot.errors.ClientError – Server rejected creation due to client error. Most likely cause is bad
project_id
ormodel_id
.
- classmethod models(project_id)
For a given project_id, list all model_id - feature_name pairs with available Image Embeddings.
- Parameters:
project_id (
str
) – Id of the project to list model_id - feature_name pairs with available Image Embeddings for.- Returns:
List of model and feature name pairs.
- Return type:
list( tuple(model_id
,feature_name) )
- classmethod list(project_id, model_id, feature_name)
Return a list of ImageEmbedding objects.
- Parameters:
project_id (
str
) – Id of the project the model belongs to.model_id (
str
) – Id of the model to list Image Embeddings for.feature_name (
str
) – Name of feature column to list Image Embeddings for.
- Return type:
List
[ImageEmbedding
]
- class datarobot.models.visualai.insights.ImageActivationMap
Mark areas of image with weight of impact on training.
This is a technique to display how various areas of the region were used in training, and their effect on predictions. Larger values in
activation_values
indicates a larger impact.- Variables:
image (
Image
) – Image object used to create this map.overlay_image (
Image
) – Image object containing the original image overlaid by the activation heatmap.feature_name (
str
) – Name of the feature column that contains the value this map is based on.activation_values (
List[List[int]]
) – A row-column matrix that contains the activation strengths for image regions. Values are integers in the range [0, 255].actual_target_value (
TargetValue
) – Actual target value of the dataset row.predicted_target_value (
TargetValue
) – Predicted target value of the dataset row that contains this image.target_values (
Optional[List[str]]
) – For classification projects a list of target values of this project.target_bins (
Optional[List[Dict[str
,float]]]
) – For regression projects a list of target bins.project_id (
str
) – Id of the project this Activation Map belongs to.model_id (
str
) – Id of the model this Activation Map belongs to.
- classmethod compute(project_id, model_id)
Start the computation of activation maps for the given model.
- Parameters:
project_id (
str
) – Project to start creation in.model_id (
str
) – Project’s model to start creation in.
- Returns:
URL to check for image embeddings progress.
- Return type:
str
- Raises:
datarobot.errors.ClientError – Server rejected creation due to client error. Most likely cause is bad
project_id
ormodel_id
.
- classmethod models(project_id)
For a given project_id, list all model_id - feature_name pairs with available Image Activation Maps.
- Parameters:
project_id (
str
) – Id of the project to list model_id - feature_name pairs with available Image Activation Maps for.- Returns:
List of model and feature name pairs.
- Return type:
list( tuple(model_id
,feature_name) )
- classmethod list(project_id, model_id, feature_name, offset=None, limit=None)
Return a list of ImageActivationMap objects.
- Parameters:
project_id (
str
) – Project that contains the images.model_id (
str
) – Model that contains the images.feature_name (
str
) – Name of feature column that contains images.offset (
Optional[int]
) – Number of images to be skipped.limit (
Optional[int]
) – Number of images to be returned.
- Return type:
List
[ImageActivationMap
]
- class datarobot.models.visualai.augmentation.ImageAugmentationOptions
A List of all supported Image Augmentation Transformations for a project. Includes additional information about minimum, maximum, and default values for a transformation.
- Variables:
name (
str
) – The name of the augmentation listproject_id (
str
) – The project containing the image data to be augmentedmin_transformation_probability (
float
) – The minimum allowed value for transformation probability.current_transformation_probability (
float
) – Default setting for probability that each transformation will be applied to an image.max_transformation_probability (
float
) – The maximum allowed value for transformation probability.min_number_of_new_images (
int
) – The minimum allowed number of new rows to add for each existing rowcurrent_number_of_new_images (
int
) – The default number of new rows to add for each existing rowmax_number_of_new_images (
int
) – The maximum allowed number of new rows to add for each existing rowtransformations (
list[dict]
) – List of transformations to possibly apply to each image
- classmethod get(project_id)
Returns a list of all supported transformations for the given project
- Parameters:
project_id (
str
) – sting The id of the project for which to return the list of supported transformations.- Return type:
- Returns:
- ImageAugmentationOptions
A list containing all the supported transformations for the project.
- class datarobot.models.visualai.augmentation.ImageAugmentationList
A List of Image Augmentation Transformations
- Variables:
name (
str
) – The name of the augmentation listproject_id (
str
) – The project containing the image data to be augmentedfeature_name (
Optional[str]
) – name of the feature that the augmentation list is associated within_use (
bool
) – Whether this is the list that will passed in to every blueprint during blueprint generation before autopilotinitial_list (
bool
) – True if this is the list to be used during training to produce augmentationstransformation_probability (
float
) – Probability that each transformation will be applied to an image. Value should be between 0.01 - 1.0.number_of_new_images (
int
) – Number of new rows to add for each existing rowtransformations (
List[Dict]
) – List of transformations to possibly apply to each imagesamples_id (
str
) – Id of last image augmentation sample generated for image augmentation list.
- classmethod create(name, project_id, feature_name=None, initial_list=False, transformation_probability=0.0, number_of_new_images=1, transformations=None, samples_id=None)
create a new image augmentation list
- Return type:
- classmethod list(project_id, feature_name=None)
List Image Augmentation Lists present in a project.
- Parameters:
project_id (
str
) – Project Id to retrieve augmentation lists for.feature_name (
Optional[str]
) – If passed, the response will only include Image Augmentation Lists active for the provided feature name.
- Return type:
list[ImageAugmentationList]
- update(name=None, feature_name=None, initial_list=None, transformation_probability=None, number_of_new_images=None, transformations=None)
Update one or multiple attributes of the Image Augmentation List in the DataRobot backend as well on this object.
- Parameters:
name (
Optional[str]
) – New name of the feature list.feature_name (
Optional[str]
) – The new feature name for which the Image Augmentation List is effective.initial_list (
Optional[bool]
) – New flag that indicates whether this list will be used during Autopilot to perform image augmentation.transformation_probability (
Optional[float]
) – New probability that each enabled transformation will be applied to an image. This does not apply to Horizontal or Vertical Flip, which are always set to 50%.number_of_new_images (
Optional[int]
) – New number of new rows to add for each existing row, updating the existing augmentation list.transformations (
Optional[list]
) – New list of Transformations to possibly apply to each image.
- Returns:
Reference to self. The passed values will be updated in place.
- Return type:
- retrieve_samples()
Lists already computed image augmentation sample for image augmentation list. Returns samples only if they have been already computed. It does not initialize computation.
- Return type:
List
ofclass ImageAugmentationSample
- compute_samples(max_wait=600)
Initializes computation and retrieves list of image augmentation samples for image augmentation list. If samples exited prior to this call method, this will compute fresh samples and return latest version of samples.
- Return type:
List
ofclass ImageAugmentationSample
- class datarobot.models.visualai.augmentation.ImageAugmentationSample
A preview of the type of images that augmentations will create during training.
- Variables:
sample_id (
ObjectId
) – The id of the augmentation sample, used to group related images togetherimage_id (
ObjectId
) – A reference to the Image which can be used to retrieve the image binaryproject_id (
ObjectId
) – A reference to the project containing the imageoriginal_image_id (
ObjectId
) – A reference to the original image that generated this image in the case of an augmented image. If this is None it signifies this is an original imageheight (
int
) – Image height in pixelswidth (
int
) – Image width in pixels
- classmethod list(auglist_id=None)
Return a list of ImageAugmentationSample objects.
- Parameters:
auglist_id (
str
) – ID for augmentation list to retrieve samples for- Return type:
List
ofclass ImageAugmentationSample