AutoMLModel#

class datarobotx.AutoMLModel(name=None, **kwargs)#

AutoML orchestrator.

Trains challenger models asynchronously and exposes the present champion for predictions or deployment. Training is performed within an automatically created DataRobot project.

Parameters:
  • name (str, optional) – Name to use for the DataRobot project that will be created. Alias for the DR ‘project_name’ configuration parameter.

  • **kwargs – Additional DataRobot configuration parameters for project creation and autopilot execution. See the DRConfig docs for usage examples.

See also

DRConfig

Configuration object for DataRobot project and autopilot settings, also includes detailed examples of usage

Inherited attributes:

dr_model

DataRobot python client datarobot.Model object for the present champion.

dr_project

DataRobot python client datarobot.Project object.

Methods:

fit(X, target, **kwargs)

Fit challenger models using DataRobot.

Inherited methods:

deploy([wait_for_autopilot, name])

Deploy the model into ML Ops.

from_project_id(project_id)

Class method to create from an existing project id.

from_url(url)

Class method to initialize from a URL string.

get_params()

Retrieve configuration parameters for the model.

predict(X[, wait_for_autopilot])

Make batch predictions using the present champion.

predict_proba(X[, wait_for_autopilot])

Calculate class probabilities using the present champion.

set_params(**kwargs)

Set or update configuration parameters for the model.

share(emails)

Share a project with other users.

deploy(wait_for_autopilot=False, name=None)#

Deploy the model into ML Ops.

Return type:

Deployment

Returns:

  • Deployment – Resulting ML Ops deployment

  • wait_for_autopilot (bool, optional, default=False) – If True, wait for autopilot to complete before deploying the model In non-notebook environments, fit() will always block until complete

  • name (str, optional, default=None) – Name for the deployment. If None, a name will be generated

property dr_model: Model#

DataRobot python client datarobot.Model object for the present champion.

Returns:

datarobot.Model object associated with this drx model

Return type:

datarobot.Model

property dr_project: Project#

DataRobot python client datarobot.Project object.

Returns:

datarobot.Project object associated with this drx.Model

Return type:

datarobot.Project

fit(X, target, **kwargs)#

Fit challenger models using DataRobot.

Creates a new DataRobot project, uploads X to DataRobot and starts Autopilot. Exposes the present champion model for making predictions or deployment; asynchronously and automatically updates the champion model.

Parameters:
  • X (pandas.DataFrame) – Training dataset for challenger models. If str, can be AI catalog dataset id or name (if unambiguous)

  • target (str) – Column name from the dataset to be used as the target variable

  • **kwargs – Additional optional fit-time parameters to pass to DataRobot i.e. ‘weights’

Return type:

AutoMLModel

See also

DRConfig

Configuration object for DataRobot project and autopilot settings, also includes detailed examples of usage.

classmethod from_project_id(project_id)#

Class method to create from an existing project id.

Initializes a new object from the provided project_id. Configuration parameters originally used to create the project and start Autopilot may not be recoverable.

Parameters:

project_id (str, optional) – DataRobot id for the project from which to initialize the object

Returns:

model – New AutopilotModel instance

Return type:

AutopilotModel

Examples

>>> from datarobotx.models.autopilot import AutopilotModel
>>> my_model = AutopilotModel.from_project_id('62f14505bab13ab73593d69e')
classmethod from_url(url)#

Class method to initialize from a URL string.

Useful for copy and pasting between GUI and notebook environments

Parameters:

url (str) – URL of a DataRobot GUI page related to the project of interest

Returns:

model – The constructed AutopilotModel object

Return type:

AutopilotModel

get_params()#

Retrieve configuration parameters for the model.

Note that some parameters may be initialized or materialized server-side after creating a project or starting Autopilot. get_params() only returns the client-side parameters which will be (or were) passed to DataRobot.

Returns:

config – Configuration object containing the parameters to be used with DataRobot

Return type:

DRConfig

predict(X, wait_for_autopilot=False, **kwargs)#

Make batch predictions using the present champion.

Predictions are calculated asynchronously - returns immediately but reinitializes the returned DataFrame with data once predictions are completed.

Predictions are made within the project containing the model using modeling workers. For real-time predictions, first deploy the model.

Parameters:
  • X (pandas.DataFrame or str) – Dataset to be scored - target column can be included or omitted. If str, can be AI catalog dataset id or name (if unambiguous)

  • wait_for_autopilot (bool, optional, default=False) – If True, wait for autopilot to complete before making predictions In non-notebook environments, fit() will always block until complete

  • **kwargs (Any) – Other key word arguments to pass to the _predict function

Returns:

Resulting predictions (contained in the column ‘predictions’) Returned immediately, updated automatically when results are completed.

Return type:

pandas.DataFrame

predict_proba(X, wait_for_autopilot=False, **kwargs)#

Calculate class probabilities using the present champion.

Only available for classifier and clustering models.

Parameters:
  • X (pandas.DataFrame or str) – Dataset to be scored - target column can be included or omitted. If str, can be AI catalog dataset id or name (if unambiguous)

  • wait_for_autopilot (bool, optional, default=False) – If True, wait for autopilot to complete before making predictions In non-notebook environments, fit() will always block until complete

  • **kwargs (Any) – Other key word arguments to pass to the _predict function

Returns:

Resulting predictions; probabilities for each label are contained in the column ‘class_{label}’; returned immediately, updated automatically when results are completed.

Return type:

pandas.DataFrame

See also

predict

set_params(**kwargs)#

Set or update configuration parameters for the model.

Parameters:

**kwargs (Any) – DataRobot configuration parameters to be set or updated. See the DRConfig docs for usage examples.

Returns:

self – AutopilotModel instance

Return type:

AutopilotModel

share(emails)#

Share a project with other users. Sets the user role as an owner of the project.

Parameters:

emails (Union[str, list]) – A list of email addresses of users to share with

Return type:

None