Blueprints
Blueprint
- class datarobot.models.Blueprint
A Blueprint for fitting models
- Variables:
id (
str) – The ID of the blueprint.processes (
List[str]) – The processes used by the blueprint.model_type (
str) – The model produced by the blueprint.project_id (
str) – The project the blueprint belongs to.blueprint_category (
str) – (New in version v2.6) Describes the category of the blueprint and the kind of model it produces.recommended_featurelist_id (
strornull) – (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 (
boolorNone) – (New in version v2.26) Whether this blueprint is supported in the Composable ML.supports_incremental_learning (
boolorNone) – (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 the 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 the documentation for tasks used in the blueprint.
- Returns:
All documents available for blueprint.
- Return type:
listofBlueprintTaskDocument
- classmethod from_data(data)
Instantiate an object of this class using a dict.
- Parameters:
data (
dict) – Correctlysnake_casedkeys 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. DataRobot has not applied casing fixes yet.keep_attrs (
iterable) – A 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 (
listofdict(name,type,description)) – Parameters that task can receive in human-readable format.links (
listofdict(name,url)) – External links used in document.references (
listofdict(name,url)) – References used in document. When no link is available, the URL equals None.
- class datarobot.models.BlueprintChart
A Blueprint chart that helps you understand data flow in a blueprint.
- Variables:
nodes (
listofdict (id,label)) – Chart nodes; each ID is unique in the chart.edges (
listoftuple (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 the blueprint to retrieve a chart for.
- Returns:
The queried blueprint chart.
- Return type:
- to_graphviz()
Get the 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 helps you understand data flow in a model. Model blueprint chart represents reduced repository blueprint chart with only elements that used to build this particular model.
- Variables:
nodes (
listofdict (ID,label)) – Chart nodes; each ID is unique in the chart.edges (
listoftuple (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 the model to retrieve a model blueprint chart for.
- Returns:
The queried model blueprint chart.
- Return type:
- to_graphviz()
Get the 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.comfor 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)
Returns a list of all 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 originalproject_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 the custom task version from which the user blueprint is created.save_to_catalog (
bool,(Default=True)) – Whether the blueprint being created should be saved to the catalog.description (
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 toinclude_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)) – Allowsproject_idto be passed as None, instead of ignored. If set to False, will not passproject_idin 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) – TheprojectIdof 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) – The ID of the project associated with the blueprint.user_blueprint_id (
string,Optional) – The ID of the user blueprint being modified.
- 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)) – TheprojectIdrepresenting 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 access to this user blueprint.
- Parameters:
id (
Optional[str]) – Only return the access control information for an 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 an 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)) – TheprojectIdrepresenting 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 a maximum of 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')
Returns a list of all 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 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. Defaultsto'-created') – Sort order which will be applied to catalog list. Valid options arecatalogName,originalName,description,created, andrelevance. For all options other than relevance, you may prefix the attribute name with a dash to sort in descending order. For example,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)) – A list ofuserBlueprintIdandblueprintIdpairs representing blueprints successfully added to the project repository.not_added_to_menu (
list(UserBlueprintNotAddedToMenuItem)) – A list ofuserBlueprintIdand error message pairs 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) – TheprojectIdof 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) – The ID of the project associated with the blueprint.user_blueprint_id (
string,Optional) – The ID of the user blueprint being modified.
- 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 project ID 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.
- Returns:
The validated task parameters response.
- 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,oneofenum(``’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) – Information about the vertex inputs and outputs.messages (
VertexContextItemMessages) – Warning and error messages for the vertex.
- class datarobot.models.user_blueprints.models.UserBlueprintCatalogSearch
An
APIObjectrepresenting 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')
Returns a list of all 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 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. Defaultsto'-created') – Sort order which will be applied to catalog list. Valid options arecatalogName,originalName,description,created, andrelevance. For all options other than relevance, you may prefix the attribute name with a dash to sort in descending order. For example,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) – The ID of the custom task.name (
str) – The name of the custom task.language (
str) – Programming language of the custom task. Can be “python”, “r”, “java”, or “other”.description (
str) – The description of the custom task.target_type (
datarobot.enums.CUSTOM_TASK_TARGET_TYPE) –The target type of the custom task. One of the following.
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.CustomTaskVersionorNone) – The 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 CustomTask.created_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) – An ISO-8601 formatted timestamp of when the custom task was created.calibrate_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. DataRobot has not applied casing fixes yet.keep_attrs (
iterable) – A 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 the 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 are returned. If not specified, all custom tasks are returned.order_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, theorder_byparameter is None, which returns custom tasks 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 the custom task by ID.
Added in version v2.26.
- Parameters:
custom_task_id (
str) – The ID of the custom task.- Returns:
The 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) – The 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) – The name of the custom task.target_type (
datarobot.enums.CUSTOM_TASK_TARGET_TYPE) –The target type based on the following values. Anything else raises 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]) – The description of the custom task.calibrate_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 the custom task properties.
Added in version v2.26.
- Parameters:
name (
Optional[str]) – The new custom task name.language (
Optional[str]) – The new custom task programming language.description (
Optional[str]) – The 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 the custom task with the latest data from the 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.
- Return type:
None
- delete()
Delete the custom task.
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.
- Return type:
None
- 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 (
listofSharingAccess) – 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 item.file_name (
str) – Name of the file item.file_path (
str) – Path of the file item.file_source (
str) – Source of the file item.created_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 version.custom_task_id (
str) – ID of the custom task.version_minor (
int) – A minor version number of custom task version.version_major (
int) – A major version number of custom task version.label (
str) – Short human readable string to label the version.created_at (
str) – ISO-8601 formatted timestamp of when the version was created.is_frozen (
bool) – A flag if the custom task version is frozen.items (
List[CustomTaskFileItem]) – A list of file items attached to the custom task version.description (
Optional[str]) – Custom task version description.base_environment_id (
Optional[str]) – ID of the environment to use with the task.base_environment_version_id (
Optional[str]) – ID of the environment version to use with the task.dependencies (
List[CustomDependency]) – The parsed dependencies of the custom task version if the version has a valid requirements.txt file.required_metadata_values (
List[RequiredMetadataValue]) – Additional parameters required by the execution environment. The required keys are defined by thefieldNamesin the base environment’srequiredMetadataKeys.arguments (
List[UserBlueprintTaskArgument]) – A list of custom task version arguments.outbound_network_policy (
CustomTaskOutboundNetworkPolicy) – The outbound network policy for the custom task version.
- 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. DataRobot has not applied casing fixes yet.keep_attrs (
iterable) – A 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 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 task.base_environment_id (
str) – The ID of the base environment to use with the custom task version.maximum_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 thefieldNamesin the base environment’srequiredMetadataKeys.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:
The 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 task.base_environment_id (
str) – The ID of the base environment to use with the custom task version.maximum_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 file item IDs to be deleted. For example,["5ea95f7a4024030aba48e4f9", "5ea6b5da402403181895cc51"].required_metadata_values (
Optional[List[RequiredMetadataValue]]) – Additional parameters required by the execution environment. The required keys are defined by thefieldNamesin the base environment’srequiredMetadataKeys.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:
The 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 the 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 the custom task version by ID.
Added in version v2.26.
- Parameters:
custom_task_id (
str) – The ID of the custom task.custom_task_version_id (
str) – The ID of the custom task version to retrieve.
- Returns:
The 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 the custom task version.
Added in version v2.26.
- Parameters:
file_path (
str) – The 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.
- Return type:
None
- update(description=None, required_metadata_values=None)
Update the custom task version properties.
Added in version v2.26.
- Parameters:
description (
str) – The new custom task version description.required_metadata_values (
List[RequiredMetadataValue]) – Additional parameters required by the execution environment. The required keys are defined by thefieldNamesin the base environment’srequiredMetadataKeys.
- 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 the custom task version with the latest data from the 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.
- Return type:
None
- 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) – The maximum 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.
- Return type:
None
- 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 the log of a custom task version dependency build. .. versionadded:: v2.27
- Parameters:
file_directory (
str (optional, default is".")) – The directory path where the downloaded file is saved.- Raises:
datarobot.errors.ClientError – If the server responded with 4xx status.
datarobot.errors.ServerError – If the server responded with 5xx status.
- Return type:
None
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.stageisdatarobot.enums.PROJECT_STAGE.EDA2then 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)
Returns a list of 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 withtarget_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 withtarget_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)
Returns a list of 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_idormodel_id.
- classmethod models(project_id)
For a given
project_id, returns allmodel_id-feature_namepairs with available Image Embeddings.- Parameters:
project_id (
str) – ID of the project to listmodel_id-feature_namepairs with available Image Embeddings for.- Returns:
A 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_valuesindicates 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_idormodel_id.
- classmethod models(project_id)
For a given
project_id, returns allmodel_id-feature_namepairs with available Image Activation Maps.- Parameters:
project_id (
str) – ID of the project to listmodel_id-feature_namepairs with available Image Activation Maps for.- Returns:
A 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 list.project_id (
str) – The project containing the image data to augment.min_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 row.current_number_of_new_images (
int) – The default number of new rows to add for each existing row.max_number_of_new_images (
int) – The maximum allowed number of new rows to add for each existing row.transformations (
list[dict]) – A list of transformations to possibly apply to each image.
- classmethod get(project_id)
Return a list of all supported transformations for the given project.
- Parameters:
project_id (
str) – The project ID.- Returns:
The image augmentation options for the project, including all supported transformations.
- Return type:
- class datarobot.models.visualai.augmentation.ImageAugmentationList
A list of image augmentation transformations.
- Variables:
name (
str) – The name of the augmentation list.project_id (
str) – The project containing the image data to augment.feature_name (
Optional[str]) – The name of the feature that the augmentation list applies to.in_use (
bool) – Whether this is the list that will passed in to every blueprint during blueprint generation before autopilot.initial_list (
bool) – True if this is the list to be used during training to produce augmentations.transformation_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) – The number of new rows to add for each existing row.transformations (
List[Dict]) – A list of transformations to possibly apply to each image.samples_id (
str) – The ID of the last image augmentation sample generated for the 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)
Return a list of image augmentation lists present in a project.
- Parameters:
project_id (
str) – The project ID to retrieve augmentation lists for.feature_name (
Optional[str]) – If passed, the response only includes image augmentation lists that are active for the provided feature name.
- Returns:
A list of image augmentation lists for the project.
- Return type:
list[ImageAugmentationList]
- update(name=None, feature_name=None, initial_list=None, transformation_probability=None, number_of_new_images=None, transformations=None)
Update the attributes of the image augmentation list in the DataRobot backend and on this object.
- Parameters:
name (
Optional[str]) – New name of the feature list.feature_name (
Optional[str]) – The new feature name that the image augmentation list applies to.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()
Return the already computed image augmentation samples for the image augmentation list. Return the samples only if they have already been computed. This method does not initialize computation.
- Returns:
A list of image augmentation sample objects.
- Return type:
list[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:
Listofclass 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 together.image_id (
ObjectId) – A reference to the image that you can use to retrieve the image binary.project_id (
ObjectId) – A reference to the project containing the image.original_image_id (
ObjectId) – A reference to the original image that generated this image in the case of an augmented image. If this is None, this is an original image.height (
int) – The image height in pixels.width (
int) – The image width in pixels.
- classmethod list(auglist_id=None)
Return a list of ImageAugmentationSample objects.
- Parameters:
auglist_id (
str) – The ID for the augmentation list to retrieve samples for.- Returns:
A list of image augmentation sample objects.
- Return type:
list[ImageAugmentationSample]