Server Objects¶
Server objects represent an entity that exists on the Driverless AI server.
Dataset¶
Dataset objects correspond to existing datasets on a Driverless AI server. Dataset objects are retrievable using the Client.
API Reference:
-
class
Dataset
¶ Interact with a dataset on the Driverless AI server.
Examples:
# Import the iris dataset ds = dai.datasets.create( data='s3://h2o-public-test-data/smalldata/iris/iris.csv', data_source='s3' ) ds.columns ds.data_source ds.file_path ds.file_size ds.key ds.name ds.shape
-
column_summaries
(columns: Optional[List[str]] = None) DatasetColumnSummaryCollection ¶ Returns a collection of column summaries.
The collection can be indexed by number or column name:
dataset.column_summaries()[0]
dataset.column_summaries()[0:3]
dataset.column_summaries()['C1']
A column summary has the following attributes:
count
: count of non-missing valuesdata_type
: raw data type detected by Driverless AI when the data was importeddatetime_format
: user defined datetime format to be used by Driverless AI (seedataset.set_datetime_format()
)freq
: count of most frequent valuelogical_types
: list of user defined data types to be used by Driverless AI (overridesdata_type
, also seedataset.set_logical_types()
)max
: maximum value for numeric datamean
: mean of values for numeric datamin
: minimum value for numeric datamissing
: count of missing valuesname
: column namesd
: standard deviation of values for numeric dataunique
: count of unique values
Printing the collection or an individual summary displays a histogram along with summary information, like so:
--- C1 --- 4.3|███████ |█████████████████ |██████████ |████████████████████ |████████████ |███████████████████ |█████████████ |████ |████ 7.9|████ Data Type: real Logical Types: ['categorical', 'numerical'] Datetime Format: Count: 150 Missing: 0 Mean: 5.84 SD: 0.828 Min: 4.3 Max: 7.9 Unique: 35 Freq: 10
Parameters: columns ( Optional
[List
[str
]]) – list of column names to include in the collectionExamples:
# Import the iris dataset ds = dai.datasets.create( data='s3://h2o-public-test-data/smalldata/iris/iris.csv', data_source='s3' ) # print column summary for the first three columns print(ds.column_summaries()[0:3])
Return type: DatasetColumnSummaryCollection
-
property
columns
: List[str]¶ List of column names.
Return type: List
[str
]
-
property
creation_timestamp
: float¶ Creation timestamp in seconds since the epoch (POSIX timestamp).
Return type: float
-
property
data_source
: str¶ Original source of data.
Return type: str
-
delete
() None ¶ Delete dataset on Driverless AI server.
Examples:
# Import the iris dataset ds = dai.datasets.create( data='s3://h2o-public-test-data/smalldata/iris/iris.csv', data_source='s3' ) ds.delete()
Return type: None
-
download
(dst_dir: str = '.', dst_file: Optional[str] = None, file_system: Optional[fsspec.spec.AbstractFileSystem] = None, overwrite: bool = False) str ¶ Download dataset from Driverless AI server as a csv.
Parameters: - dst_dir (
str
) – directory where csv will be saved - dst_file (
Optional
[str
]) – name of csv file (overrides default file name) - file_system (
Optional
[ForwardRef
]) – FSSPEC based file system to download to, instead of local file system - overwrite (
bool
) – overwrite existing file
Examples:
# Import the iris dataset ds = dai.datasets.create( data='s3://h2o-public-test-data/smalldata/iris/iris.csv', data_source='s3' ) ds.download()
Return type: str
- dst_dir (
-
export
(**kwargs: Any) str ¶ Export dataset csv from the Driverless AI server. Returns a relative path for the exported csv.
Note
Export location is configured on the Driverless AI server.
Return type: str
-
property
file_path
: str¶ Path to dataset bin file on the server.
Return type: str
-
property
file_size
: int¶ Size in bytes of dataset bin file on the server.
Return type: int
-
head
(num_rows: int = 5) Table ¶ Return headers and first n rows of dataset in a Table.
Parameters: num_rows ( int
) – number of rows to showExamples:
# Load in the iris dataset ds = dai.datasets.create( data='s3://h2o-public-test-data/smalldata/iris/iris.csv', data_source='s3' ) # Print the headers and first 5 rows print(ds.head(num_rows=5))
Return type: Table
-
property
key
: str¶ Universally unique identifier.
Return type: str
-
modify_by_code
(code: str, names: Optional[List[str]] = None) Dict[str, Dataset] ¶ Create a dictionary of new datasets from original dataset modified by a Python
code
string, that is the body of a function where:- there is an input variable
X
that represents the original dataset in the form of a datatable frame (dt.Frame) - return type is one of dt.Frame, pd.DataFrame, np.ndarray or a list of those
Parameters: - code (
str
) – Python code that modifiesX
- names (
Optional
[List
[str
]]) – optional list of names for the new dataset(s)
Examples:
# Import the iris dataset ds = dai.datasets.create( data='s3://h2o-public-test-data/smalldata/iris/iris.csv', data_source='s3' ) # Keep the first 4 columns new_dataset = ds.modify_by_code( 'return X[:, :4]', names=['new_dataset'] ) # Split on 4th column new_datasets = ds.modify_by_code( 'return [X[:, :4], X[:, 4:]]', names=['new_dataset_1', 'new_dataset_2'] )
The dictionary will map the dataset
names
to the returned element(s) from the Pythoncode
string.Return type: Dict
[str
,Dataset
]- there is an input variable
-
modify_by_code_preview
(code: str) Table ¶ Get a preview of the dataset modified by a Python
code
string, where:- there exists a variable
X
that represents the original dataset in the form of a datatable frame (dt.Frame) - return type is one of dt.Frame, pd.DataFrame, np.ndarray or a list of those (only first element of the list is shown in preview)
Parameters: code ( str
) – Python code that modifiesX
Examples:
# Import the iris dataset ds = dai.datasets.create( data='s3://h2o-public-test-data/smalldata/iris/iris.csv', data_source='s3' ) # Keep first 4 columns ds.modify_by_code_preview('return X[:, :4]')
Return type: Table
- there exists a variable
-
modify_by_recipe
(recipe: str, names: Optional[List[str]] = None) Dict[str, Dataset] ¶ Create a dictionary of new datasets from original dataset modified by a recipe.
The dictionary will map the dataset
names
to the returned element(s) from the recipe.Parameters: - recipe (
str
) – path to recipe or url for recipe - names (
Optional
[List
[str
]]) – optional list of names for the new dataset(s)
Examples:
# Import the airlines dataset ds = dai.datasets.create( data='s3://h2o-public-test-data/smalldata/airlines/allyears2k_headers.zip', data_source='s3' ) # Modify original dataset with a recipe new_ds = ds.modify_by_recipe( recipe='https://github.com/h2oai/driverlessai-recipes/blob/rel-1.8.4/data/airlines_multiple.py', names=['new_airlines1', 'new_airlines2'] )
Return type: Dict
[str
,Dataset
]- recipe (
-
property
name
: str¶ Display name.
Return type: str
-
rename
(name: str) Dataset ¶ Change dataset display name.
Parameters: name ( str
) – new display nameExamples:
# Import the iris dataset ds = dai.datasets.create( data='s3://h2o-public-test-data/smalldata/iris/iris.csv', data_source='s3' ) ds.name ds.rename(name='new-iris-name') ds.name
Return type: Dataset
-
set_datetime_format
(columns: Dict[str, str]) None ¶ Set datetime format of columns.
Parameters: columns ( Dict
[str
,str
]) – dictionary where the key is the column name and the value is a valid datetime formatExamples:
# Import the Eurodate dataset date = dai.datasets.create( data='s3://h2o-public-test-data/smalldata/jira/v-11-eurodate.csv', data_source='s3' ) # Set the date time format for column ‘ds5' date.set_datetime_format({'ds5': '%d-%m-%y %H:%M'})
Return type: None
-
set_logical_types
(columns: Dict[str, Union[str, List[str]]]) None ¶ Designate columns to have the specified logical types. The logical type is mainly used to determine which transformers to try on the column’s data.
Possible logical types:
'categorical'
'date'
'datetime'
'id'
'numerical'
'text'
Parameters: columns ( Dict
[str
,Union
[str
,List
[str
]]]) – dictionary where the key is the column name and the value is the logical type or a list of logical types for the column (to unset all logical types use a value ofNone
)Example:
# Import the prostate dataset prostate = dai.datasets.create( data='s3://h2o-public-test-data/smalldata/prostate/prostate.csv', data_source='s3' ) # Set the logical types prostate.set_logical_types( {'ID': 'id', 'AGE': ['categorical', 'numerical'], 'RACE': None} )
Return type: None
-
property
shape
: Tuple[int, int]¶ Dimensions (rows, cols).
Return type: Tuple
[int
,int
]
-
split_to_train_test
(train_size: float = 0.5, train_name: Optional[str] = None, test_name: Optional[str] = None, target_column: Optional[str] = None, fold_column: Optional[str] = None, time_column: Optional[str] = None, seed: int = 1234) Dict[str, Dataset] ¶ Split a dataset into train/test sets on the Driverless AI server and return a dictionary of Dataset objects with the keys
'train_dataset'
and'test_dataset'
.Parameters: - train_size (
float
) – proportion of dataset rows to put in the train split - train_name (
Optional
[str
]) – name for the train dataset - test_name (
Optional
[str
]) – name for the test dataset - target_column (
Optional
[str
]) – use stratified sampling to create splits - fold_column (
Optional
[str
]) – keep rows belonging to the same group together - time_column (
Optional
[str
]) – split rows such that the splits are sequential with respect to time - seed (
int
) – random seed
Note
Only one of
target_column
,fold_column
, ortime_column
can be passed at a time.Examples:
# Import the iris dataset ds = dai.datasets.create( data='s3://h2o-public-test-data/smalldata/iris/iris.csv', data_source='s3' ) # Split the iris dataset into train/test sets ds_split = ds.split_to_train_test(train_size=0.7)
Return type: Dict
[str
,Dataset
]- train_size (
-
split_to_train_test_async
(train_size: float = 0.5, train_name: Optional[str] = None, test_name: Optional[str] = None, target_column: Optional[str] = None, fold_column: Optional[str] = None, time_column: Optional[str] = None, seed: int = 1234) DatasetSplitJob ¶ Launch creation of a dataset train/test split on the Driverless AI server and return a DatasetSplitJob object to track the status.
Parameters: - train_size (
float
) – proportion of dataset rows to put in the train split - train_name (
Optional
[str
]) – name for the train dataset - test_name (
Optional
[str
]) – name for the test dataset - target_column (
Optional
[str
]) – use stratified sampling to create splits - fold_column (
Optional
[str
]) – keep rows belonging to the same group together - time_column (
Optional
[str
]) – split rows such that the splits are sequential with respect to time - seed (
int
) – random seed
Note
Only one of
target_column
,fold_column
, ortime_column
can be passed at a time.Examples:
# Import the iris dataset ds = dai.datasets.create( data='s3://h2o-public-test-data/smalldata/iris/iris.csv', data_source='s3' ) # Launch the creation of a dataset train/test split on the DAI server ds_split = ds.split_to_train_test_async(train_size=0.7)
Return type: DatasetSplitJob
- train_size (
-
tail
(num_rows: int = 5) Table ¶ Return headers and last n rows of dataset in a Table.
Parameters: num_rows ( int
) – number of rows to showExamples:
ds = dai.datasets.create( data='s3://h2o-public-test-data/smalldata/iris/iris.csv', data_source='s3' ) # Print the headers and last 5 rows print(ds.tail(num_rows=5))
Return type: Table
-
-
class
DatasetJob
¶ Monitor creation of a dataset on the Driverless AI server.
-
is_complete
() bool ¶ Return
True
if job completed successfully.Return type: bool
-
is_running
() bool ¶ Return
True
if job is scheduled, running, or finishing.Return type: bool
-
property
key
: str¶ Universally unique identifier.
Return type: str
-
property
name
: str¶ Display name.
Return type: str
-
result
(silent: bool = False) Dataset ¶ Wait for job to complete, then return a Dataset object.
Parameters: silent ( bool
) – if True, don’t display status updatesReturn type: Dataset
-
status
(verbose: int = 0) str ¶ Return job status string.
Parameters: verbose ( int
) –- 0: short description
- 1: short description with progress percentage
- 2: detailed description with progress percentage
Return type: str
-
Experiment¶
Experiment objects correspond to existing experiments on a Driverless AI server. Experiment objects are retrievable using the Client.
API Reference:
-
class
Experiment
¶ Interact with an experiment on the Driverless AI server.
-
abort
() None ¶ Terminate experiment immediately and only generate logs.
Return type: None
-
property
artifacts
: driverlessai._experiments.ExperimentArtifacts¶ Interact with artifacts that are created when the experiment completes.
Return type: ExperimentArtifacts
-
property
creation_timestamp
: float¶ Creation timestamp in seconds since the epoch (POSIX timestamp).
Return type: float
-
property
datasets
: Dict[str, Optional[driverlessai._datasets.Dataset]]¶ Dictionary of
train_dataset
,validation_dataset
, andtest_dataset
used for the experiment.Return type: Dict
[str
,Optional
[Dataset
]]
-
delete
() None ¶ Permanently delete experiment from the Driverless AI server.
Return type: None
-
export_dai_file
(dst_dir: str = '.', dst_file: Optional[str] = None, file_system: Optional[fsspec.spec.AbstractFileSystem] = None, overwrite: bool = False) str ¶ Export experiment from Driverless AI server in dai format.
Parameters: - dst_dir (
str
) – directory where dai file will be saved - dst_file (
Optional
[str
]) – name of dai file (overrides default file name) - file_system (
Optional
[ForwardRef
]) – FSSPEC based file system to download to, instead of local file system - overwrite (
bool
) – overwrite existing file
Return type: str
- dst_dir (
-
finish
() None ¶ Finish experiment by jumping to final pipeline training and generating experiment artifacts.
Return type: None
-
gui
() Hyperlink ¶ Get full URL for the experiment’s page on the Driverless AI server.
Return type: Hyperlink
-
is_complete
() bool ¶ Return
True
if job completed successfully.Return type: bool
-
property
is_deprecated
: bool¶ True
if experiment was created by an old version of Driverless AI and is no longer fully compatible with the current server version.Return type: bool
-
is_running
() bool ¶ Return
True
if job is scheduled, running, or finishing.Return type: bool
-
property
key
: str¶ Universally unique identifier.
Return type: str
-
property
log
: driverlessai._experiments.ExperimentLog¶ Interact with experiment logs.
Return type: ExperimentLog
-
metrics
() Dict[str, Union[str, float]] ¶ Return dictionary of experiment scorer metrics and AUC metrics, if available.
Return type: Dict
[str
,Union
[str
,float
]]
-
property
name
: str¶ Display name.
Return type: str
-
notifications
() List[Dict[str, str]] ¶ Return list of experiment notification dictionaries.
Return type: List
[Dict
[str
,str
]]
-
predict
(dataset: Dataset, enable_mojo: bool = True, include_columns: Optional[List[str]] = None, include_labels: Optional[bool] = None, include_raw_outputs: Optional[bool] = None, include_shap_values_for_original_features: Optional[bool] = None, include_shap_values_for_transformed_features: Optional[bool] = None, use_fast_approx_for_shap_values: Optional[bool] = None) Prediction ¶ Predict on a dataset, then return a Prediction object.
Parameters: - dataset (
Dataset
) – a Dataset object corresonding to a dataset on the Driverless AI server - enable_mojo (
bool
) – use MOJO (if available) to make predictions (server versions >= 1.9.1) - include_columns (
Optional
[List
[str
]]) – list of columns from the dataset to append to the prediction csv - include_labels (
Optional
[bool
]) – append labels in addition to probabilities for classification, ignored for regression (server versions >= 1.10) - include_raw_outputs (
Optional
[bool
]) – append predictions as margins (in link space) to the prediction csv - include_shap_values_for_original_features (
Optional
[bool
]) – append original feature contributions to the prediction csv (server versions >= 1.9.1) - include_shap_values_for_transformed_features (
Optional
[bool
]) – append transformed feature contributions to the prediction csv - use_fast_approx_for_shap_values (
Optional
[bool
]) – speed up prediction contributions with approximation (server versions >= 1.9.1)
Return type: - dataset (
-
predict_async
(dataset: Dataset, enable_mojo: bool = True, include_columns: Optional[List[str]] = None, include_labels: Optional[bool] = None, include_raw_outputs: Optional[bool] = None, include_shap_values_for_original_features: Optional[bool] = None, include_shap_values_for_transformed_features: Optional[bool] = None, use_fast_approx_for_shap_values: Optional[bool] = None) PredictionJobs ¶ Launch prediction job on a dataset and return a PredictionJobs object to track the status.
Parameters: - dataset (
Dataset
) – a Dataset object corresonding to a dataset on the Driverless AI server - enable_mojo (
bool
) – use MOJO (if available) to make predictions (server versions >= 1.9.1) - include_columns (
Optional
[List
[str
]]) – list of columns from the dataset to append to the prediction csv - include_labels (
Optional
[bool
]) – append labels in addition to probabilities for classification, ignored for regression (server versions >= 1.10) - include_raw_outputs (
Optional
[bool
]) – append predictions as margins (in link space) to the prediction csv - include_shap_values_for_original_features (
Optional
[bool
]) – append original feature contributions to the prediction csv (server versions >= 1.9.1) - include_shap_values_for_transformed_features (
Optional
[bool
]) – append transformed feature contributions to the prediction csv - use_fast_approx_for_shap_values (
Optional
[bool
]) – speed up prediction contributions with approximation (server versions >= 1.9.1)
Return type: - dataset (
-
rename
(name: str) Experiment ¶ Change experiment display name.
Parameters: name ( str
) – new display nameReturn type: Experiment
-
result
(silent: bool = False) Experiment ¶ Wait for training to complete, then return self.
Parameters: silent ( bool
) – if True, don’t display status updatesReturn type: Experiment
-
retrain
(use_smart_checkpoint: bool = False, final_pipeline_only: bool = False, final_models_only: bool = False, **kwargs: Any) Experiment ¶ Create a new experiment using the same datasets and settings. Through
kwargs
it’s possible to pass new datasets or overwrite settings.Parameters: - use_smart_checkpoint (
bool
) – start experiment from last smart checkpoint - final_pipeline_only (
bool
) – trains final pipeline using smart checkpoint if available, otherwise uses default hyperparameters - final_models_only (
bool
) – trains final pipeline models (but not transformers) using smart checkpoint if available, otherwise uses default hyperparameters and transformers (overrides final_pipeline_only) - kwargs (
Any
) – datasets and experiment settings as defined inexperiments.create()
Return type: - use_smart_checkpoint (
-
retrain_async
(use_smart_checkpoint: bool = False, final_pipeline_only: bool = False, final_models_only: bool = False, **kwargs: Any) Experiment ¶ Launch creation of a new experiment using the same datasets and settings. Through kwargs it’s possible to pass new datasets or overwrite settings.
Parameters: - use_smart_checkpoint (
bool
) – start experiment from last smart checkpoint - final_pipeline_only (
bool
) – trains final pipeline using smart checkpoint if available, otherwise uses default hyperparameters - final_models_only (
bool
) – trains final pipeline models (but not transformers) using smart checkpoint if available, otherwise uses default hyperparameters and transformers (overrides final_pipeline_only) - kwargs (
Any
) – datasets and experiment settings as defined inexperiments.create()
Return type: - use_smart_checkpoint (
-
property
run_duration
: Optional[float]¶ Run duration in seconds.
Return type: Optional
[float
]
-
property
settings
: Dict[str, Any]¶ Experiment settings.
Return type: Dict
[str
,Any
]
-
property
size
: int¶ Size in bytes of all experiment’s files on the Driverless AI server.
Return type: int
-
status
(verbose: int = 0) str ¶ Return job status string.
Parameters: verbose ( int
) –- 0: short description
- 1: short description with progress percentage
- 2: detailed description with progress percentage
Return type: str
-
summary
() None ¶ Print experiment summary.
Return type: None
-
Experiment Artifacts¶
Experiment artifacts include anything outputted after a successfully completed experiment. These artificats include the autoreport, scoring pipelines, prediction csvs, experiment summary, and logs.
API Reference:
-
class
ExperimentArtifacts
¶ Interact with files created by an experiment on the Driverless AI server.
-
create
(artifact: str) None ¶ (Re)build certain artifacts, if possible.
(re)buildable artifacts:
'autodoc'
'mojo_pipeline'
'python_pipeline'
Parameters: artifact ( str
) – name of artifact to (re)buildReturn type: None
-
download
(only: Union[str, List[str]] = None, dst_dir: str = '.', file_system: Optional[fsspec.spec.AbstractFileSystem] = None, include_columns: Optional[List[str]] = None, overwrite: bool = False) Dict[str, str] ¶ Download experiment artifacts from the Driverless AI server. Returns a dictionary of relative paths for the downloaded artifacts.
Parameters: - only (
Union
[str
,List
[str
]]) – specify specific artifacts to download, useexperiment.artifacts.list()
to see the available artifacts on the Driverless AI server - dst_dir (
str
) – directory where experiment artifacts will be saved - file_system (
Optional
[ForwardRef
]) – FSSPEC based file system to download to, instead of local file system - include_columns (
Optional
[List
[str
]]) – list of dataset columns to append to prediction csvs - overwrite (
bool
) – overwrite existing files
Return type: Dict
[str
,str
]- only (
-
export
(only: Optional[Union[str, List[str]]] = None, include_columns: Optional[List[str]] = None, **kwargs: Any) Dict[str, str] ¶ Export experiment artifacts from the Driverless AI server. Returns a dictionary of relative paths for the exported artifacts.
Parameters: - only (
Union
[str
,List
[str
],None
]) – specify specific artifacts to export, useex.artifacts.list()
to see the available artifacts on the Driverless AI server - include_columns (
Optional
[List
[str
]]) – list of dataset columns to append to prediction csvs
Note
Export location is configured on the Driverless AI server.
Return type: Dict
[str
,str
]- only (
-
property
file_paths
: Dict[str, str]¶ Paths to artifact files on the server.
Return type: Dict
[str
,str
]
-
list
() List[str] ¶ List of experiment artifacts that exist on the Driverless AI server.
Return type: List
[str
]
-
Experiment Logs¶
Experiment logs list the events recorded during an experiment.
API Reference:
-
class
ExperimentLog
¶ Interact with experiment logs.
-
download
(archive: bool = True, dst_dir: str = '.', dst_file: Optional[str] = None, file_system: Optional[fsspec.spec.AbstractFileSystem] = None, overwrite: bool = False) str ¶ Download experiment logs from the Driverless AI server.
Parameters: - archive (
bool
) – if available, prefer downloading an archive that contains multiple log files and stack traces if any were created - dst_dir (
str
) – directory where logs will be saved - dst_file (
Optional
[str
]) – name of log file (overrides default file name) - file_system (
Optional
[ForwardRef
]) – FSSPEC based file system to download to, instead of local file system - overwrite (
bool
) – overwrite existing file
Return type: str
- archive (
-
head
(num_lines: int = 50) None ¶ Print first n lines of experiment log.
Parameters: num_lines ( int
) – number of lines to printReturn type: None
-
tail
(num_lines: int = 50) None ¶ Print last n lines of experiment log.
Parameters: num_lines ( int
) – number of lines to printReturn type: None
-
Predictions¶
Prediction objects are created when predicting on a new dataset.
API Reference:
-
class
Prediction
¶ Interact with predictions from the Driverless AI server.
-
download
(dst_dir: str = '.', dst_file: Optional[str] = None, file_system: Optional[fsspec.spec.AbstractFileSystem] = None, overwrite: bool = False) str ¶ Download csv of predictions.
Parameters: - dst_dir (
str
) – directory where csv will be saved - dst_file (
Optional
[str
]) – name of csv file (overrides default file name) - file_system (
Optional
[ForwardRef
]) – FSSPEC based file system to download to, instead of local file system - overwrite (
bool
) – overwrite existing file
Return type: str
- dst_dir (
-
property
file_paths
: List[str]¶ Paths to prediction csv files on the server.
Return type: List
[str
]
-
property
included_dataset_columns
: List[str]¶ Columns from dataset that are appended to predictions.
Return type: List
[str
]
-
property
includes_labels
: bool¶ Whether classification labels are appended to predictions.
Return type: bool
-
property
includes_raw_outputs
: bool¶ Whether predictions as margins (in link space) were appended to predictions.
Return type: bool
-
property
includes_shap_values_for_original_features
: bool¶ Whether original feature contributions are appended to predictions (server versions >= 1.9.1).
Return type: bool
-
property
includes_shap_values_for_transformed_features
: bool¶ Whether transformed feature contributions are appended to predictions.
Return type: bool
-
property
keys
: Dict[str, str]¶ Dictionary of unique IDs for entities related to the prediction: dataset: unique ID of dataset used to make predictions experiment: unique ID of experiment used to make predictions prediction: unique ID of predictions
Return type: Dict
[str
,str
]
-
to_pandas
() pandas.DataFrame ¶ Transfer predictions to a local Pandas DataFrame.
Return type: pandas.DataFrame
-
property
used_fast_approx_for_shap_values
: Optional[bool]¶ Whether approximation was used to calculate prediction contributions (server versions >= 1.9.1).
Return type: Optional
[bool
]
-
-
class
PredictionJobs
¶ Monitor creation of predictions on the Driverless AI server.
-
property
included_dataset_columns
: List[str]¶ Columns from dataset that are appended to predictions.
Return type: List
[str
]
-
property
includes_labels
: bool¶ Whether classification labels are appended to predictions.
Return type: bool
-
property
includes_raw_outputs
: bool¶ Whether predictions as margins (in link space) are appended to predictions.
Return type: bool
-
property
includes_shap_values_for_original_features
: bool¶ Whether original feature contributions are appended to predictions (server versions >= 1.9.1).
Return type: bool
-
property
includes_shap_values_for_transformed_features
: bool¶ Whether transformed feature contributions are appended to predictions.
Return type: bool
-
is_complete
() bool ¶ Return
True
if all jobs completed successfully.Return type: bool
-
is_running
() bool ¶ Return
True
if one or more jobs is running or finishing.Return type: bool
-
property
jobs
: Sequence[driverlessai._utils.ServerJob]¶ List of ServerJob objects.
Return type: Sequence
[ServerJob
]
-
property
keys
: Dict[str, str]¶ Dictionary of entity unique IDs: dataset: unique ID of dataset used to make predictions experiment: unique ID of experiment used to make predictions prediction: unique ID of predictions
Return type: Dict
[str
,str
]
-
result
(silent: bool = False) Prediction ¶ Wait for all jobs to complete.
Parameters: silent ( bool
) – if True, don’t display status updatesReturn type: Prediction
-
status
(verbose: int = 0) List[str] ¶ Returns list of job status strings.
Parameters: verbose ( int
) –- 0: short description
- 1: short description with progress percentage
- 2: detailed description with progress percentage
Return type: List
[str
]
-
property
used_fast_approx_for_shap_values
: Optional[bool]¶ Whether approximation was used to calculate prediction contributions (server versions >= 1.9.1).
Return type: Optional
[bool
]
-
property
Interpretation¶
Interpretation objects correspond to existing interpretations on a Driverless AI server. Interpretation objects are retrievable using the Client.
API Reference:
-
class
Interpretation
¶ Interact with a MLI interpretation on the Driverless AI server.
-
property
artifacts
: driverlessai._mli.InterpretationArtifacts¶ Interact with artifacts that are created when the interpretation completes.
Return type: InterpretationArtifacts
-
property
creation_timestamp
: float¶ Creation timestamp in seconds since the epoch (POSIX timestamp).
Return type: float
-
property
dataset
: Optional[driverlessai._datasets.Dataset]¶ Dataset for the interpretation.
Return type: Optional
[Dataset
]
-
delete
() None ¶ Delete MLI interpretation on Driverless AI server.
Return type: None
-
property
experiment
: Optional[driverlessai._experiments.Experiment]¶ Experiment for the interpretation.
Return type: Optional
[Experiment
]
-
gui
() Hyperlink ¶ Get full URL for the interpretation’s page on the Driverless AI server.
Return type: Hyperlink
-
is_complete
() bool ¶ Return
True
if job completed successfully.Return type: bool
-
is_running
() bool ¶ Return
True
if job is scheduled, running, or finishing.Return type: bool
-
property
key
: str¶ Universally unique identifier.
Return type: str
-
property
name
: str¶ Display name.
Return type: str
-
rename
(name: str) Interpretation ¶ Change interpretation display name.
Parameters: name ( str
) – new display nameReturn type: Interpretation
-
result
(silent: bool = False) Interpretation ¶ Wait for job to complete, then return an Interpretation object.
Return type: Interpretation
-
property
run_duration
: Optional[float]¶ Run duration in seconds.
Return type: Optional
[float
]
-
property
settings
: Dict[str, Any]¶ Interpretation settings.
Return type: Dict
[str
,Any
]
-
status
(verbose: int = 0) str ¶ Return job status string.
Parameters: verbose ( int
) –- 0: short description
- 1: short description with progress percentage
- 2: detailed description with progress percentage
Return type: str
-
property
Interpretation Artifacts¶
Interpretation artifacts include anything available for download after a successfully completed interpretation.
API Reference:
-
class
InterpretationArtifacts
¶ Interact with files created by a MLI interpretation on the Driverless AI server.
-
download
(only: Union[str, List[str]] = None, dst_dir: str = '.', file_system: Optional[fsspec.spec.AbstractFileSystem] = None, overwrite: bool = False) Dict[str, str] ¶ Download interpretation artifacts from the Driverless AI server. Returns a dictionary of relative paths for the downloaded artifacts.
Parameters: - only (
Union
[str
,List
[str
]]) – specify specific artifacts to download, useinterpretation.artifacts.list()
to see the available artifacts on the Driverless AI server - dst_dir (
str
) – directory where interpretation artifacts will be saved - file_system (
Optional
[ForwardRef
]) – FSSPEC based file system to download to, instead of local file system - overwrite (
bool
) – overwrite existing files
Return type: Dict
[str
,str
]- only (
-
property
file_paths
: Dict[str, str]¶ Paths to artifact files on the server.
Return type: Dict
[str
,str
]
-
list
() List[str] ¶ List of interpretation artifacts that exist on the Driverless AI server.
Return type: List
[str
]
-
Project¶
Project objects correspond to existing projects on a Driverless AI server. Project objects are retrievable using the Client.
API Reference:
-
class
Project
¶ Interact with a project on the Driverless AI server.
-
property
datasets
: Dict[str, Sequence[driverlessai._datasets.Dataset]]¶ Datasets linked to the project.
Return type: Dict
[str
,Sequence
[Dataset
]]
-
delete
(include_experiments: bool = False) None ¶ Permanently delete project from the Driverless AI server.
Parameters: include_experiments ( bool
) – unlink & delete experiments linked to this project.Return type: None
-
property
description
: Optional[str]¶ Project description.
Return type: Optional
[str
]
-
property
experiments
: Sequence[driverlessai._experiments.Experiment]¶ Experiments linked to the project.
Return type: Sequence
[Experiment
]
-
gui
() Hyperlink ¶ Get full URL for the project’s page on the Driverless AI server.
Return type: Hyperlink
-
property
key
: str¶ Universally unique identifier.
Return type: str
-
link_dataset
(dataset: Dataset, dataset_type: str, link_associated_experiments: bool = False) Project ¶ Link a dataset to the project.
Parameters: - dataset (
Dataset
) – a Dataset object corresonding to a dataset on the Driverless AI server - dataset_type (
str
) – can be one of:'train_dataset(s)'
,'validation_dataset(s)'
, or'test_dataset(s)'
- link_associated_experiments (
bool
) – also link experiments that used the dataset (server versions >= 1.9.1)
Return type: - dataset (
-
link_experiment
(experiment: Experiment) Project ¶ Link an experiment to the project.
Parameters: experiment ( Experiment
) – an Experiment object corresonding to a experiment on the Driverless AI serverReturn type: Project
-
property
name
: str¶ Display name.
Return type: str
-
redescribe
(description: str) Project ¶ Change project description. Requires server version >= 1.9.1.
Parameters: description ( str
) – new descriptionReturn type: Project
-
rename
(name: str) Project ¶ Change project display name.
Parameters: name ( str
) – new display nameReturn type: Project
Share a project. Requires server versions >= 1.9.3 with H2O.ai Storage connected.
Parameters: - username (
str
) – Driverless AI username of user to share with - role (
str
) – one of “Default” or “Reader”
Return type: None
- username (
-
property
sharings
: List[Dict[str, Optional[str]]]¶ Users the project is shared with. Requires server versions >= 1.9.3 with H2O.ai Storage connected.
Return type: List
[Dict
[str
,Optional
[str
]]]
-
unlink_dataset
(dataset: Dataset, dataset_type: str) Project ¶ Unlink a dataset from the project.
Parameters: - dataset (
Dataset
) – a Dataset object corresonding to a dataset on the Driverless AI server - dataset_type (
str
) – can be one of:'train_dataset(s)'
,'validation_dataset(s)'
, or'test_dataset(s)'
Return type: - dataset (
-
unlink_experiment
(experiment: Experiment) Project ¶ Unlink an experiment from the project.
Parameters: experiment ( Experiment
) – an Experiment object corresonding to a experiment on the Driverless AI serverReturn type: Project
Unshare a project. Requires server versions >= 1.9.3 with H2O.ai Storage connected.
Parameters: username ( str
) – Driverless AI username of user to unshare withReturn type: None
-
property
Recipe¶
Recipe objects correspond to existing recipes on a Driverless AI server. Recipe objects are retrievable using the Client.
API Reference:
-
class
ExplainerRecipe
¶ Interact with an explainer recipe on the Driverless AI server.
-
property
for_binomial
: bool¶ True
if explainer works for binomial models.Return type: bool
-
property
for_iid
: bool¶ True
if explainer works for I.I.D. models.Return type: bool
-
property
for_multiclass
: bool¶ True
if explainer works for multiclass models.Return type: bool
-
property
for_regression
: bool¶ True
if explainer works for regression models.Return type: bool
-
property
for_timeseries
: bool¶ True
if explainer works for time series models.Return type: bool
-
property
id
: str¶ Identifier.
Return type: str
-
property
is_custom
: bool¶ True
if the recipe is custom.Return type: bool
-
property
key
: str¶ Universally unique identifier.
Return type: str
-
property
name
: str¶ Display name.
Return type: str
-
search_settings
(search_term: str, show_description: bool = False) None ¶ Search explainer settings and print results. Useful when looking for explainer kwargs (see
explainer.with_settings()
) to use when creating interpretations.Parameters: - search_term (
str
) – term to search for (case insensitive) - show_description (
bool
) – include description in results
Return type: None
- search_term (
-
property
settings
: Dict[str, Any]¶ Explainer settings set by user.
Return type: Dict
[str
,Any
]
-
with_settings
(**kwargs: Any) ExplainerRecipe ¶ Changes the explainer settings from defaults. Settings reset to defaults everytime this is called.
Note
To search possible explainer settings for your server version, use
explainer.search_settings(search_term)
.Return type: ExplainerRecipe
-
property
-
class
ModelRecipe
¶ Interact with a model recipe on the Driverless AI server.
-
property
is_custom
: bool¶ True
if the recipe is custom.Return type: bool
-
property
is_unsupervised
: bool¶ True
if recipe doesn’t require a target column.Return type: bool
-
property
key
: str¶ Universally unique identifier.
Return type: str
-
property
name
: str¶ Display name.
Return type: str
-
property
-
class
ScorerRecipe
¶ Interact with a scorer recipe on the Driverless AI server.
-
property
description
: str¶ Recipe description.
Return type: str
-
property
for_binomial
: bool¶ True
if scorer works for binomial models.Return type: bool
-
property
for_multiclass
: bool¶ True
if scorer works for multiclass models.Return type: bool
-
property
for_regression
: bool¶ True
if scorer works for regression models.Return type: bool
-
property
is_custom
: bool¶ True
if the recipe is custom.Return type: bool
-
property
key
: str¶ Universally unique identifier.
Return type: str
-
property
name
: str¶ Display name.
Return type: str
-
property
Utility¶
API Reference:
-
class
Hyperlink
¶ Renders clickable link in notebooks but otherwise behaves the same as
str
.
Visualization¶
Visualization objects correspond to existing dataset visualizations on a Driverless AI server. Visualization objects are retrievable using the Client.
API Reference:
-
class
Visualization
¶ Interact with a dataset visualization on the Driverless AI server.
-
delete
() None ¶ Permanently delete visualization from the Driverless AI server.
Return type: None
-
gui
() Hyperlink ¶ Get full URL for the visualization’s page on the Driverless AI server.
Return type: Hyperlink
-
is_complete
() bool ¶ Return
True
if job completed successfully.Return type: bool
-
property
is_deprecated
: Optional[bool]¶ True
if visualization was created by an old version of Driverless AI and is no longer fully compatible with the current server version.Return type: Optional
[bool
]
-
is_running
() bool ¶ Return
True
if job is scheduled, running, or finishing.Return type: bool
-
property
key
: str¶ Universally unique identifier.
Return type: str
-
property
name
: str¶ Display name.
Return type: str
-
result
(silent: bool = False) Visualization ¶ Wait for job to complete, then return self.
Parameters: silent ( bool
) – if True, don’t display status updatesReturn type: Visualization
-
status
(verbose: int = 0) str ¶ Return job status string.
Parameters: verbose ( int
) –- 0: short description
- 1: short description with progress percentage
- 2: detailed description with progress percentage
Return type: str
-