Model#

class datarobotx.Model(project_id=None, model_id=None)[source]#

DataRobot training model

Represents a model on a project leaderboard. Implements prediction and deployment asynchronously.

Parameters:
  • model_id (str, optional) – DataRobot id for the model from which to initialize the object

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

Attributes:

dr_model

DataRobot python client datarobot.Model object

dr_project

DataRobot python client datarobot.Project object

Methods:

deploy([name])

Deploy the model into ML Ops

from_url([url])

Class method to initialize from a URL string

predict(X)

Make batch predictions using the model

predict_proba(X)

Calculate class probabilities using the model

deploy(name=None)[source]#

Deploy the model into ML Ops

Parameters:

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

Returns:

Resulting ML Ops deployment

Return type:

Deployment

property dr_model: datarobot.Model#

DataRobot python client datarobot.Model object

Returns:

datarobot.Model object associated with this drx.Model

Return type:

datarobot.Model

property dr_project: datarobot.Project#

DataRobot python client datarobot.Project object

Returns:

datarobot.Project object associated with this drx.Model

Return type:

datarobot.Project

classmethod from_url(url=None)[source]#

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 model of interest

Returns:

model – The constructed Model object

Return type:

Model

predict(X)[source]#

Make batch predictions using the model

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)

Returns:

Resulting predictions (contained in the column ‘predictions’) Returned immediately, updated automatically when results are completed. If attribute access is attempted, will block until results are completed.

Return type:

FutureDataFrame

predict_proba(X)[source]#

Calculate class probabilities using the model

Only available for classifier models.

Parameters:

X (pandas.DataFrame or str) – Dataset to compute class probabilities on; target column can be included or omitted. If str, can be AI catalog dataset id or name (if unambiguous)

Returns:

Resulting predictions; probabilities for each label are contained in the column ‘class_{label}’; returned immediately, updated automatically when results are completed. If attribute access is attempted, will block until results are completed.

Return type:

FutureDataFrame

See also

predict