Deployment#
- class datarobotx.Deployment(deployment_id=None)#
DataRobot ML Ops deployment.
Implements real-time predictions on ML Ops deployments
- Parameters:
deployment_id (str, optional) – DataRobot id for the deployment from which to initialize the object
Attributes:
DataRobot python client datarobot.Deployment object.
Methods:
from_url
(url)Class method to initialize from a URL string.
predict
(X[, batch_mode, max_explanations, ...])Make predictions on X asynchronously using the deployment.
predict_proba
(X[, batch_mode, ...])Calculate class probabilities on X asynchronously using the deployment.
Make predictions with data asynchronously using the deployment.
share
(emails)Share a deployment with other users.
- property dr_deployment: Deployment#
DataRobot python client datarobot.Deployment object.
- Returns:
datarobot.Deployment object associated with this drx.Deployment
- Return type:
datarobot.Deployment
- 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 deployment of interest
- Returns:
model – The deployed model object
- Return type:
- predict(X, batch_mode=False, max_explanations=None, as_of=None, for_dates=None, **kwargs)#
Make predictions on X asynchronously using the deployment.
Returns empty DataFrame which will be updated with results when complete
- Parameters:
X (pd.DataFrame or str) – Data to make predictions on. For text generation deployments, the prompt can be passed as a single string in which event it is converted for use in LLM playground models where the column will be named promptText
batch_mode (bool (default=False)) – If True, use batch mode for predictions
max_explanations (int or 'all' (default=None)) – Number of explanations to return for each prediction. Note that ‘all’ is supported for deployments using SHAP models only.
as_of (str (default=None)) – Applies to time series only. Forecast point to use for predictions. If not provided on a forecast, the latest forecast point will be used. Note that dates passed in are parsed using pd.to_datetime.
for_dates (str or tuple of str (default=None)) – Applies to time series only. Date(s) to return predictions for. If a single date is specified, a single prediction will be returned for that date. If a tuple of dates is specified, a prediction will be returned for each date in the range. Note that dates passed in are parsed using pd.to_datetime.
**kwargs (
Any
) – Additional optional predict-time parameters to pass to DataRobot Examples: ‘forecast_point’, ‘predictions_start_date’, ‘predictions_end_date’, ‘relax_known_in_advance_features_check’
- Return type:
- predict_proba(X, batch_mode=False, max_explanations=None, as_of=None, for_dates=None, **kwargs)#
Calculate class probabilities on X asynchronously using the deployment.
Returns empty DataFrame which will be updated with results when complete
- Parameters:
X (pd.DataFrame) – Data to make predictions on
batch_mode (bool (default=False)) – If True, use batch mode for predictions
max_explanations (int or 'all' (default=None)) – Number of explanations to return for each prediction. Note that ‘all’ is supported for deployments using SHAP models only.
as_of (str (default=None)) – Applies to time series only. Forecast point to use for predictions. If not provided on a forecast, the latest forecast point will be used. Note that dates passed in are parsed using pd.to_datetime.
for_dates (str or tuple of str (default=None)) – Applies to time series only. Date(s) to return predictions for. If a single date is specified, a single prediction will be returned for that date. If a tuple of dates is specified, a prediction will be returned for each date in the range. Note that dates passed in are parsed using pd.to_datetime.
**kwargs (
Any
) – Additional optional predict-time parameters to pass to DataRobot Examples: ‘forecast_point’, ‘predictions_start_date’, ‘predictions_end_date’, ‘relax_known_in_advance_features_check’
- Return type:
- predict_unstructured(X)#
Make predictions with data asynchronously using the deployment.
Returns empty dict which will be updated with results when complete