AutoTSModel#
- class datarobotx.AutoTSModel(name=None, feature_window=None, forecast_window=None, **kwargs)#
AutoTS orchestrator.
Applies automatic feature engineering and a model selection process optimized for the nuances of time-series modeling (e.g. automatic engineering of lag variables, handling of varying forecast horizons).
- Parameters:
name (str, optional) – Name to use for the DataRobot project that will be created. Alias for the DR ‘project_name’ configuration parameter.
feature_window (tuple of int, optional) –
Window of time relative to the forecast point over which to automatically derive features. Expected format is a tuple: (start, end) e.g. (-20, 0). Larger windows require more data for predictions. Window unit of time is automatically detected but can be explicitly specified separately.
Alias for the DR ‘feature_derivation_window_start’ and ‘feature_derivation_window_end’ configuration parameters.
forecast_window (tuple of int, optional) –
Window of time relative to the forecast point for which predictions are of interest. Expected format is a tuple: (start, end) e.g. (1, 5). Window unit of time is automatically detected but can be explicitly specified separately.
Alias for the DR ‘forecast_window_start’ and ‘forecast_window_end’ configuration parameters.
**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:
DataRobot python client datarobot.Model object for the present champion.
DataRobot python client datarobot.Project object.
Methods:
fit
(X, datetime_partition_column[, target, ...])Fit time-series challenger models using DataRobot.
predict
(X[, wait_for_autopilot, as_of, ...])Make predictions for a time-series dataset.
predict_proba
(X[, wait_for_autopilot, ...])Calculate class probabilities using the present champion.
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.
Retrieve configuration parameters for the model.
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:
- 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, datetime_partition_column, target=None, kia_columns=None, multiseries_id_columns=None, segmentation_id_column=None, **kwargs)#
Fit time-series challenger models using DataRobot.
Automatically engineers temporally lagged features and establishes time-series champion models across a forecast horizon of interest.
- Parameters:
X (pandas.DataFrame or str) – Training dataset for challenger models. If str, can be AI catalog dataset id or name (if unambiguous)
target (str, default=None) – Column name from the dataset to be used as the target variable. If None, TS anomaly detection will be executed.
datetime_partition_column (str) – Column name from the dataset containing the primary date/time feature to be used in partitioning, feature engineering, and establishing forecast horizons
multiseries_id_columns (str or list of str, optional) – Column name from the dataset containing a series identifier for each row. If specified, DataRobot will treat this as a multiseries problem. Presently only a single series id column is supported.
kia_columns (list of str, optional) – List of column names for features that are known at prediction time. If not empty, DataRobot will require these features in prediction dataset.
segmentation_id_column (str, optional) – Column name from the dataset containing a segmentation identifier for each row. If specified, DataRobot will perform segmented modeling to break the problem into multiple projects.
**kwargs (
Any
) – Additional optional fit-time parameters to pass to DataRobot i.e. ‘weights’
- Return type:
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:
- predict(X, wait_for_autopilot=False, as_of=None, for_dates=None, **kwargs)#
Make predictions for a time-series dataset.
- Parameters:
X (pandas.DataFrame or str) – Dataset for which predictions are to be made. If str, can be AI catalog dataset id
wait_for_autopilot (bool, default=False) –
as_of (str or datetime, optional) – Date/time to use as the forecast point for predictions. If not specified, the latest date/time in the dataset will be used. Note that dates passed in are parsed using pd.to_datetime.
for_dates (str or tuple of str or datetime, optional) – Dates 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’
- Returns:
Resulting predictions; probabilities for each label are contained in the column ‘class_{label}’; returned immediately, updated automatically when results are completed.
- Return type:
- predict_proba(X, wait_for_autopilot=False, as_of=None, for_dates=None, **kwargs)#
Calculate class probabilities using the present champion.
- Parameters:
X (pandas.DataFrame or str) – Dataset for which predictions are to be made. If str, can be AI catalog dataset id
wait_for_autopilot (bool, default=False) –
as_of (str, optional) – Date/time to use as the forecast point for predictions. If not specified, the latest date/time in the dataset will be used. Note that dates passed in are parsed using pd.to_datetime
for_dates (str or tuple of str, optional) – Dates 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’
- Returns:
Resulting predictions; probabilities for each label are contained in the column ‘class_{label}’; returned immediately, updated automatically when results are completed.
- Return type: