Data exports
- class datarobot.models.deployment.data_exports.PredictionDataExport
A prediction data export.
Added in version v3.4.
- Variables:
id (
str) – The ID of the prediction data export.model_id (
str) – The ID of the model (or null if not specified).created_at (
datetime) – Prediction data export creation timestamp.period (
Period) – A prediction data time range definition.status (
ExportStatus) – A prediction data export processing state.error (
ExportError) – Error description, appears when prediction data export job failed (status is FAILED).batches (
ExportBatches) – Metadata associated with exported batch.deployment_id (
str) – The ID of the deployment.
- classmethod list(deployment_id, status=None, model_id=None, batch=None, offset=0, limit=100)
Retrieve a list of prediction data exports.
- Parameters:
deployment_id (
str) – The ID of the deployment.model_id (
Optional[str]) – The ID of the model used for prediction data export.status (
Optional[ExportStatus]) – A prediction data export processing state.batch (
Optional[bool]) – If true, only return batch exports. If false, only return real-time exports. If not provided, return both real-time and batch exports.limit (
Optional[int]) – The maximum number of objects to return. The default is 100 (0 means no limit).offset (
Optional[int]) – The starting offset of the results. The default is 0.
- Returns:
prediction_data_exports – A list of PredictionDataExport objects.
- Return type:
Examples
from datarobot.models.deployment import PredictionDataExport prediction_data_exports = PredictionDataExport.list(deployment_id='5c939e08962d741e34f609f0')
- classmethod get(deployment_id, export_id)
Retrieve a single prediction data export.
- Parameters:
deployment_id (
str) – The ID of the deployment.export_id (
str) – The ID of the prediction data export.
- Returns:
prediction_data_export – A prediction data export.
- Return type:
Examples
from datarobot.models.deployment import PredictionDataExport prediction_data_export = PredictionDataExport.get( deployment_id='5c939e08962d741e34f609f0', export_id='65fbe59aaa3f847bd5acc75b' )
- classmethod create(deployment_id, start, end, model_id=None, batch_ids=None, max_wait=600)
Create a deployment prediction data export. Waits until ready and fetches PredictionDataExport after the export finishes. This method is blocking.
- Parameters:
deployment_id (
str) – The ID of the deployment.start (
Union[datetime,str]) – Inclusive start of the time range.end (
Union[datetime,str]) – Exclusive end of the time range.model_id (
Optional[str]) – The ID of the model.batch_ids (
Optional[List[str]]) – IDs of batches to export. Null for real-time data exports.max_wait (
int,) – Seconds to wait for successful resolution.
- Returns:
prediction_data_export – A prediction data export.
- Return type:
Examples
from datetime import datetime, timedelta from datarobot.models.deployment import PredictionDataExport now=datetime.now() prediction_data_export = PredictionDataExport.create( deployment_id='5c939e08962d741e34f609f0', start=now - timedelta(days=7), end=now )
- fetch_data()
Return data from prediction export as datarobot Dataset.
- Returns:
prediction_datasets – List of datasets for a given export, most often it is just one.
- Return type:
List[Dataset]
Examples
from datarobot.models.deployment import PredictionDataExport prediction_data_export = PredictionDataExport.get( deployment_id='5c939e08962d741e34f609f0', export_id='65fbe59aaa3f847bd5acc75b' ) prediction_datasets = prediction_data_export.fetch_data()
- class datarobot.models.deployment.data_exports.ActualsDataExport
An actuals data export.
Added in version v3.4.
- Variables:
id (
str) – The ID of the actuals data export.model_id (
str) – The ID of the model (or null if not specified).created_at (
datetime) – Actuals data export creation timestamp.period (
Period) – A actuals data time range definition.status (
ExportStatus) – A data export processing state.error (
ExportError) – Error description, appears when actuals data export job failed (status is FAILED).only_matched_predictions (
bool) – If true, exports actuals with matching predictions only.deployment_id (
str) – The ID of the deployment.
- classmethod list(deployment_id, status=None, offset=0, limit=100)
Retrieve a list of actuals data exports.
- Parameters:
deployment_id (
str) – The ID of the deployment.status (
Optional[ExportStatus]) – Actuals data export processing state.limit (
Optional[int]) – The maximum number of objects to return. The default is 100 (0 means no limit).offset (
Optional[int]) – The starting offset of the results. The default is 0.
- Returns:
actuals_data_exports – A list of ActualsDataExport objects.
- Return type:
Examples
from datarobot.models.deployment import ActualsDataExport actuals_data_exports = ActualsDataExport.list(deployment_id='5c939e08962d741e34f609f0')
- classmethod get(deployment_id, export_id)
Retrieve a single actuals data export.
- Parameters:
deployment_id (
str) – The ID of the deployment.export_id (
str) – The ID of the actuals data export.
- Returns:
actuals_data_export – An actuals data export.
- Return type:
Examples
from datarobot.models.deployment import ActualsDataExport actuals_data_export = ActualsDataExport.get( deployment_id='5c939e08962d741e34f609f0', export_id='65fb0a6c9bb187781cfdea36' )
- classmethod create(deployment_id, start, end, model_id=None, only_matched_predictions=None, max_wait=600)
Create a deployment actuals data export. Waits until ready and fetches ActualsDataExport after the export finishes. This method is blocking.
- Parameters:
deployment_id (
str) – The ID of the deployment.start (
Union[datetime,str]) – Inclusive start of the time range.end (
Union[datetime,str]) – Exclusive end of the time range.model_id (
Optional[str]) – The ID of the model.only_matched_predictions (
Optional[bool]) – If true, exports actuals with matching predictions only.max_wait (
int) – Seconds to wait for successful resolution.
- Returns:
actuals_data_export – An actuals data export.
- Return type:
Examples
from datetime import datetime, timedelta from datarobot.models.deployment import ActualsDataExport now=datetime.now() actuals_data_export = ActualsDataExport.create( deployment_id='5c939e08962d741e34f609f0', start=now - timedelta(days=7), end=now )
- fetch_data()
Return data from actuals export as datarobot Dataset.
- Returns:
actuals_datasets – List of datasets for a given export, most often it is just one.
- Return type:
List[Dataset]
Examples
from datarobot.models.deployment import ActualsDataExport actuals_data_export = ActualsDataExport.get( deployment_id='5c939e08962d741e34f609f0', export_id='65fb0a6c9bb187781cfdea36' ) actuals_datasets = actuals_data_export.fetch_data()
- class datarobot.models.deployment.data_exports.TrainingDataExport
A training data export.
Added in version v3.4.
- Variables:
id (
str) – The ID of the training data export.model_id (
str) – The ID of the model (or null if not specified).model_package_id (
str) – The ID of the model package.created_at (
datetime) – Training data export creation timestamp.deployment_id (
str) – The ID of the deployment.
- classmethod list(deployment_id)
Retrieve a list of successful training data exports.
- Parameters:
deployment_id (
str) – The ID of the deployment.- Returns:
training_data_exports – A list of TrainingDataExport objects.
- Return type:
Examples
from datarobot.models.deployment import TrainingDataExport training_data_exports = TrainingDataExport.list(deployment_id='5c939e08962d741e34f609f0')
- classmethod get(deployment_id, export_id)
Retrieve a single training data export.
- Parameters:
deployment_id (
str) – The ID of the deployment.export_id (
str) – The ID of the training data export.
- Returns:
training_data_export – A training data export.
- Return type:
Examples
from datarobot.models.deployment import TrainingDataExport training_data_export = TrainingDataExport.get( deployment_id='5c939e08962d741e34f609f0', export_id='65fbf2356124f1daa3acc522' )
- classmethod create(deployment_id, model_id=None, max_wait=600)
Create a single training data export. Waits until ready and fetches TrainingDataExport after the export finishes. This method is blocking.
- Parameters:
deployment_id (
str) – The ID of the deployment.model_id (
Optional[str]) – The ID of the model.max_wait (
int) – Seconds to wait for successful resolution.
- Return type:
str- Returns:
dataset_id (
str) – A created dataset with training data.Examples
--------code-block::python– from datarobot.models.deployment import TrainingDataExport dataset_id = TrainingDataExport.create(deployment_id=’5c939e08962d741e34f609f0’)
- fetch_data()
Return data from training data export as datarobot Dataset.
- Returns:
training_dataset – A datasets for a given export.
- Return type:
Dataset
Examples
from datarobot.models.deployment import TrainingDataExport training_data_export = TrainingDataExport.get( deployment_id='5c939e08962d741e34f609f0', export_id='65fbf2356124f1daa3acc522' ) training_data_export = training_data_export.fetch_data()
- class datarobot.models.deployment.data_exports.DataQualityExport
A data quality export record.
Added in version v3.6.
- Variables:
association_id (
str) – The association ID of the data quality export.timestamp (
datetime) – The data quality export creation timestamp.deployment_id (
str) – The ID of the deployment.prompt (
Optional[str]) – The LLM prompt of the data quality export.predicted_value (
str) – The predicted value of the data quality export.actual_value (
Optional[str]) – The actual value (if available) of the data quality export.context (
List[Dict[str,str]]) – Context data (context and link data) for the contexts associated with the data quality export.metrics (
List[Dict[str,Any]]) – Custom-metrics data for the data quality export.
- classmethod list(deployment_id, start, end, model_id=None, prediction_pattern=None, prompt_pattern=None, actual_pattern=None, order_by=None, order_metric=None, filter_metric=None, filter_value=None, offset=0, limit=100)
Retrieve a list of data-quality export records for a given deployment.
Added in version v3.6.
- Parameters:
deployment_id (
str) – The ID of the deployment.start (
Union[str,datetime]) – The earliest time of the objects to return.end (
Union[str,datetime]) – The latest time of the objects to return.model_id (
Optional[str]) – The ID of the model.prediction_pattern (
Optional[str]) – The keywords to search in a predicted value for a text generation target.prompt_pattern (
Optional[str]) – The keywords to search in a prompt value for a text generation target.actual_pattern (
Optional[str]) – The keywords to search in an actual value for a text generation target.order_by (
Optional[str]) – The field to sort by (e.g. associationId, timestamp, or customMetrics). Use a leading ‘-’ to indicate descending order. When ordering by a custom-metric, must also specify ‘order_metric’. The default is None, which equates to ‘-timestamp’.order_metric (
Optional[str]) – When ‘order_by’ is a custom-metric, this specifies the custom-metric name or ID to use for ordering. The default is None.filter_metric (
Optional[str]) – Specifies the metric name or ID to use for matching. Must also use ‘filter_value’ to specify the value that must be matched. The default is None.filter_value (
Optional[str]) – Specifies the value associated with ‘filter_metric’ that must be matched. The default is None.offset (
Optional[int]) – The starting offset of the results. The default is 0.limit (
Optional[int]) – The maximum number of objects to return. The default is 100 (which is maximum).
- Returns:
data_quality_exports – A list of DataQualityExport objects.
- Return type:
Examples
from datarobot.models.deployment import DataQualityExport data_quality_exports = DataQualityExport.list( deployment_id='5c939e08962d741e34f609f0', start_time='2024-07-01', end_time='2024-08-01 )