Client

Note

The client supports password and token based authentication, such as local, PAM, LDAP, and OpenID. Certificate based authentication such as Mutual TLS is not currently supported by the client.

API Reference:

class Client

Connect to and interact with a Driverless AI server.

Parameters:
  • address (str) – full URL of the Driverless AI server to connect to
  • username (Optional[str]) – username for authentication on the Driverless AI server
  • password (Optional[str]) – password for authentication on the Driverless AI server
  • token_provider (Optional[Callable[[], str]]) – callable that provides an authentication token, if provided, will ignore username and password values
  • verify (Union[bool, str]) – when using https on the Driverless AI server, setting this to False will disable SSL certificates verification. A path to cert(s) can also be passed to verify, see: https://requests.readthedocs.io/en/master/user/advanced/#ssl-cert-verification
  • backend_version_override (Optional[str]) – version of client backend to use, overrides Driverless AI server version detection. Specify "latest" to get the most recent backend supported. In most cases the user should rely on Driverless AI server version detection and leave this as the default None.

Examples:

### Connect with username and password
dai = driverlessai.Client(
    address='http://localhost:12345',
    username='py',
    password='py'
)

### Connect with token (assumes the Driverless AI server is configured
### to allow clients to authenticate through tokens)

# 1) set up a token provider with a refresh token from the Driverless AI web UI
token_provider = driverlessai.token_providers.OAuth2TokenProvider(
    refresh_token="eyJhbGciOiJIUzI1N...",
    client_id="python_client",
    token_endpoint_url="https://keycloak-server/auth/realms/..."
    token_introspection_url="https://keycloak-server/auth/realms/..."
)

# 2) use the token provider to get authorization to connect to the
# Driverless AI server
dai = driverlessai.Client(
    address="https://localhost:12345",
    token_provider=token_provider.ensure_fresh_token
)
property admin: driverlessai._admin.Admin
Performs administrative tasks on Driverless AI server.

Warning

Requires DriverlessAI server version 1.10.3 or higher.

Return type:Admin
property autodocs: driverlessai._autodoc.AutoDocs

Interact with autodocs on the Driverless AI server.

Warning

A beta API that is subject to future changes.

Return type:AutoDocs
property autoviz: driverlessai._autoviz.AutoViz

Interact with dataset visualizations on the Driverless AI server.

Return type:AutoViz
property connectors: driverlessai._datasets.Connectors

Interact with connectors on the Driverless AI server.

Return type:Connectors
property datasets: driverlessai._datasets.Datasets

Interact with datasets on the Driverless AI server.

Return type:Datasets
property deployments: driverlessai._deployments.Deployments

Interact with datasets on the Driverless AI server.

Warning

Requires DriverlessAI server version 1.10.6 or higher.

Warning

A beta API that is subject to future changes.

Return type:Deployments
property experiments: driverlessai._experiments.Experiments

Interact with experiments on the Driverless AI server.

Return type:Experiments
property mli: driverlessai._mli.MLI

Interact with experiment interpretations on the Driverless AI server.

Return type:MLI
property model_diagnostics: driverlessai._model_diagnostics.ModelDiagnostics

Interact with model diagnostics on the Driverless AI server.

Return type:ModelDiagnostics
property projects: driverlessai._projects.Projects

Interact with projects on the Driverless AI server.

Return type:Projects
property recipes: driverlessai._recipes.Recipes

Interact with recipes on the Driverless AI server.

Return type:Recipes
property server: driverlessai._server.Server

Get information about the Driverless AI server.

Return type:Server

Interact with Server Entities

The following attributes of a connected client allow you to interact with entities such as datasets or experiments on the Driverless AI server.

AutoViz

The autoviz attribute of a connected client provides methods to create, get, and list dataset visualizations on the Driverless AI server.

API Reference:

class AutoViz

Interact with dataset visualizations on the Driverless AI server.

create(dataset: Dataset) Visualization

Create a dataset visualization on the Driverless AI server.

Parameters:dataset (Dataset) – Dataset object
Return type:Visualization
create_async(dataset: Dataset) VisualizationJob

Launch creation of a dataset visualization on the Driverless AI server.

Parameters:dataset (Dataset) – Dataset object
Return type:VisualizationJob
get(key: str) Visualization

Get a Visualization object corresponding to a dataset visualization on the Driverless AI server.

Parameters:key (str) – Driverless AI server’s unique ID for the visualization
Return type:Visualization
gui() Hyperlink

Get full URL for the AutoViz page on the Driverless AI server.

Return type:Hyperlink
list(start_index: int = 0, count: Optional[int] = None) Sequence[Visualization]

Return list of dataset Visualization objects.

Parameters:
  • start_index (int) – index on Driverless AI server of first visualization in list
  • count (Optional[int]) – number of visualizations to request from the Driverless AI server
Return type:

Sequence[Visualization]

Admin

The admin attribute of a connected client provides methods to perform administrative tasks on the Driverless AI server.

API Reference:

class Admin
property is_admin: Optional[bool]

Returns True if the user is an admin.

Return type:Optional[bool]
list_current_users() List[str]
Returns a list of users who are currently
logged-in to the Driverless AI server.

Warning

Requires DriverlessAI server version 1.10.5 or higher.

Warning

A beta API that is subject to future changes.

Return type:List[str]
list_datasets(username: str) List[DatasetProxy]

List datasets of the specified user.

Warning

A beta API that is subject to future changes.

Return type:List[DatasetProxy]
list_experiments(username: str) List[ExperimentProxy]

List experiments of the specified user.

Warning

A beta API that is subject to future changes.

Return type:List[ExperimentProxy]
list_server_logs() List[DAIServerLog]

Lists the server logs of Driverless AI server.

Warning

Requires DriverlessAI server version 1.10.5 or higher.

Return type:List[DAIServerLog]
list_users() List[str]

Returns a list of users in the Driverless AI server.

Return type:List[str]
transfer_data(from_user: str, to_user: str) None

Transfer all data of from_user to to_user.

Return type:None
class DatasetProxy

A Proxy for admin access for a dataset in the Driverless AI server.

delete() None

Delete this entity.

Return type:None
property key: str

Universally unique identifier.

Return type:str
property name: str

Display name.

Return type:str
property owner: str

Owner of the object.

Return type:str
class ExperimentProxy

A Proxy for admin access for an experiment in the Driverless AI server.

property creation_timestamp: float

Creation timestamp in seconds since the epoch (POSIX timestamp).

Return type:float
property datasets: Dict[str, Optional[driverlessai._admin.DatasetProxy]]

Dictionary of train_dataset,``validation_dataset``, and test_dataset used for this experiment.

Return type:Dict[str, Optional[DatasetProxy]]
delete() None

Delete this entity.

Return type:None
is_complete() bool

Returns True if this job completed successfully.

Return type:bool
is_running() bool

Returns True if this 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
property owner: str

Owner of the object.

Return type:str
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

Returns the status of this job.

Parameters:verbose (int) –
  • 0: short description
  • 1: short description with progress percentage
  • 2: detailed description with progress percentage
Return type:str

Connectors

The connectors attribute of a connected client currently gives you a method to list connectors that have been enabled on the Driverless AI server.

Connectors are strings that designate a method to get data into the server:

  • upload : standard upload feature
  • file : local file system/server file system
  • hdfs : Hadoop file system, remember to configure the HDFS config folder path and keytab on the server
  • dtap : Blue Data Tap file system, remember to configure DTap on the server
  • s3 : Amazon S3, optionally configure secret and access key on the server
  • gcs : Google Cloud Storage, remember to configure gcs_path_to_service_account_json on the server
  • gbq : Google Big Query, remember to configure gcs_path_to_service_account_json on the server
  • minio : Minio Cloud Storage, remember to configure secret and access key on the server
  • snow : Snowflake Data Warehouse, remember to configure Snowflake credentials on the server (account name, username, password)
  • kdb : KDB+ Time Series Database, remember to configure KDB credentials on the server (hostname and port, optionally: username, password, classpath, and jvm_args)
  • azrbs : Azure Blob Storage, remember to configure Azure credentials on the server (account name, account key)
  • jdbc: JDBC Connector
  • hive: Hive Connector
  • recipe_file: custom recipe file upload
  • recipe_url: custom recipe upload via url
  • feature_store: Feature Store, remember to configure feature_store_endpoint_url on the server

These strings can be passed as the data_source argument for the dataset create functions. Data sources are exposed in the form of the file systems, and each file system is prefixed by a unique prefix. For example:

  • To reference data on S3, use s3://.
  • To reference data on HDFS, use the prefix hdfs://.
  • To reference data on Azure Blob Store, use https://<storage_name>.blob.core.windows.net.
  • To reference data on BlueData Datatap, use dtap://.
  • To reference data on Google BigQuery, make sure you know the Google BigQuery dataset and the table that you want to query. Use a standard SQL query to ingest data.
  • To reference data on Google Cloud Storage, use gs://.
  • To reference data on kdb+, use the hostname and the port http://<kdb_server>:<port>.
  • To reference data on Minio, use http://<endpoint_url>.
  • To reference data on Snowflake, use a standard SQL query to ingest data.
  • To access a SQL database via JDBC, use a SQL query with the syntax associated with your database.

Advanced Connectors

Advanced connectors require a data_source_config argument for the dataset create functions. The following connectors are considered advanced:

Google Big Query:

config = {
    'gbq_dataset_name': <required>,
    'gbq_bucket_name': <required>,
    'gbq_location': <optional>  # Specify a location/region to use with the GBQ connector.
    'gbq_project': <optional>  # Specify a project to use with the GBQ connector.
}

Note

Driverless AI’s connection to Google Big Query will inherit the top-level directory from the service JSON file. So if a dataset named “my-dataset” is in a top-level directory named “dai-gbq”, then the value for the dataset ID input field would be “my-dataset” and not “dai-gbq:my-dataset”.

Note

gbq_location is only supported in Driverless AI server versions >= 1.10.1.

Note

gbq_project is only supported in Driverless AI server versions >= 1.9.3.

Hive:

config = {
    'hive_conf_path': <optional>,  # Path to hadoop configuration directory.
    'hive_auth_type': <optional>,  # Type of authentication to use, can be [noauth, keytab, keytabimpersonation].
    'hive_keytab_path': <optional>,  # Path to keytab if using keytab authentication.
    'hive_principal_user': <optional>,  # User ID authorized by keytab to make queries.
    'hive_default_config': <optional>  # Name of database configuration in config.toml to use. If provided, will ignore all other optional arguments, and will take them directly from config.toml.
}

JDBC:

config = {
    'jdbc_username': <required>,
    'jdbc_password': <required>,
    'jdbc_url': <optional>,  # JDBC connection url. Requires jdbc_jar and jdbc_driver to be provided.
    'jdbc_jar': <optional>,  # Path to JDBC driver jar. Requires jdbc_url and jdbc_driver to be provided.
    'jdbc_driver': <optional>,  # Classpath of JDBC driver. Requires jdbc_jar and jdbc_url to be provided.
    'jdbc_default_config': <optional>,  # Name of database configuration in config.toml to use. If provided, will ignore jdbc_jar, jdbc_url, jdbc_driver values.
    'id_column': <optional>  # Name of id column in dataset. Specify this field when making large data queries.
}

Note

Due to resource sharing within Driverless AI, the JDBC Connector is only allocated a relatively small amount of memory. When making large queries, the ID column is used to partition the data into manageable portions. This ensures that the maximum memory allocation is not exceeded. If a query that is larger than the maximum memory allocation is made without specifying an ID column, the query will not complete successfully.

Snowflake:

config = {
    'snowflake_database': <required>,
    'snowflake_warehouse': <required>,
    'snowflake_schema': <required>,
    'snowflake_region': <optional>,
    'snowflake_role': <optional>,
    'snowflake_formatting': <optional>,  # Additional arguments for formatting the output SQL query to csv file. See snowflake documentation for "Create File Format".
    'snowflake_username': <optional>,
    'snowflake_password': <optional>
    'snowflake_account': <optional>
}

Note

snowflake_account is only supported in Driverless AI server versions >= 1.10.2.

Feature Store:

config = {
    'feature_store_project': <required>
}

Note

Feature Store connector is only supported in Driverless AI server versions >= 1.10.4.

API Reference:

class Connectors

Interact with data sources that are enabled on the Driverless AI server.

list() List[str]

Return list of data sources enabled on the Driverless AI server.

Examples:

dai.connectors.list()
Return type:List[str]

Datasets

The datasets attribute of a connected client provides methods to create, get, and list datasets on the Driverless AI server.

API Reference:

class Datasets

Interact with datasets on the Driverless AI server.

create(data: Union[str, pandas.DataFrame], data_source: str = 'upload', data_source_config: Dict[str, str] = None, force: bool = False, name: str = None) Dataset

Create a dataset on the Driverless AI server and return a Dataset object corresponding to the created dataset.

Parameters:
  • data (Union[str, ForwardRef]) – path to data file(s) or folder, a Pandas DataFrame, or query string for SQL based data sources
  • data_source (str) – name of connector to use for data transfer (use driverlessai.connectors.list() to see configured names)
  • data_source_config (Dict[str, str]) – dictionary of configuration options for advanced connectors
  • force (bool) – create new dataset even if dataset with same name already exists
  • name (str) – dataset name on the Driverless AI server

Examples:

ds = dai.datasets.create(
    data='s3://h2o-public-test-data/smalldata/iris/iris.csv',
    data_source='s3'
)
Return type:Dataset
create_async(data: Union[str, pandas.DataFrame], data_source: str = 'upload', data_source_config: Dict[str, str] = None, force: bool = False, name: str = None) DatasetJob

Launch creation of a dataset on the Driverless AI server and return a DatasetJob object to track the status.

Parameters:
  • data (Union[str, ForwardRef]) – path to data file(s) or folder, a Pandas DataFrame, or query string for SQL based data sources
  • data_source (str) – name of connector to use for data transfer (use driverlessai.connectors.list() to see configured names)
  • data_source_config (Dict[str, str]) – dictionary of configuration options for advanced connectors
  • force (bool) – create new dataset even if dataset with same name already exists
  • name (str) – dataset name on the Driverless AI server

Examples:

ds = dai.datasets.create_async(
    data='s3://h2o-public-test-data/smalldata/iris/iris.csv',
    data_source='s3'
)
Return type:DatasetJob
get(key: str) Dataset

Get a Dataset object corresponding to a dataset on the Driverless AI server. If the dataset only exists on H2O.ai Storage, it will be imported to the server first.

Parameters:key (str) – Driverless AI server’s unique ID for the dataset

Examples:

# Use the UUID of the dataset to retrieve the dataset object
key = 'e7de8630-dbfb-11ea-9f69-0242ac110002'
ds = dai.datasets.get(key=key)
Return type:Dataset
gui() Hyperlink

Get full URL for the user’s datasets page on Driverless AI server.

Examples:

dai.datasets.gui()
Return type:Hyperlink
list(start_index: int = 0, count: Optional[int] = None) Sequence[Dataset]

List of Dataset objects available to the user.

Parameters:
  • start_index (int) – index on Driverless AI server of first dataset to list
  • count (Optional[int]) – max number of datasets to request from the Driverless AI server

Examples:

dai.datasets.list(start_index=10, count=5)
Return type:Sequence[Dataset]

Experiments

API Reference:

class Experiments

Interact with experiments on the Driverless AI server.

create(train_dataset: Dataset, target_column: Optional[str], task: str, force: bool = False, name: Optional[str] = None, **kwargs: Any) Experiment

Launch an experiment on the Driverless AI server and wait for it to complete before returning.

Parameters:
  • train_dataset (Dataset) – Dataset object
  • target_column (Optional[str]) – name of column in train_dataset (pass None if task is 'unsupervised')
  • task (str) – one of 'regression', 'classification', or 'unsupervised'
  • force (bool) – create new experiment even if experiment with same name already exists
  • name (Optional[str]) – display name for experiment
Keyword Arguments:
 
  • accuracy (int) – accuracy setting [1-10]
  • time (int) – time setting [1-10]
  • interpretability (int) – interpretability setting [1-10]
  • scorer (Union[str,ScorerRecipe]) – metric to optimize for
  • models (Union[str,ModelRecipe]) – limit experiment to these models
  • transformers (Union[str,TransformerRecipe]) – limit experiment to these transformers
  • validation_dataset (Dataset) – Dataset object
  • test_dataset (Dataset) – Dataset object
  • weight_column (str) – name of column in train_dataset
  • fold_column (str) – name of column in train_dataset
  • time_column (str) – name of column in train_dataset, containing time ordering for timeseries problems
  • time_groups_columns (List[str]) – list of column names, contributing to time ordering
  • unavailable_at_prediction_time_columns (List[str]) – list of column names, which won’t be present at prediction time
  • drop_columns (List[str]) – list of column names to be dropped
  • enable_gpus (bool) – allow GPU usage in experiment
  • reproducible (bool) – set experiment to be reproducible
  • time_period_in_seconds (int) – the length of the time period in seconds, used in timeseries problems
  • num_prediction_periods (int) – timeseries forecast horizon in time period units
  • num_gap_periods (int) – number of time periods after which forecast starts
  • config_overrides (str) – Driverless AI config overrides in TOML string format

Note

Any expert setting can also be passed as a kwarg. To search possible expert settings for your server version, use experiments.search_expert_settings(search_term).

Return type:Experiment
create_async(train_dataset: Dataset, target_column: Optional[str], task: str, force: bool = False, name: Optional[str] = None, **kwargs: Any) Experiment

Launch an experiment on the Driverless AI server and return an Experiment object to track the experiment status.

Parameters:
  • train_dataset (Dataset) – Dataset object
  • target_column (Optional[str]) – name of column in train_dataset (pass None if task is 'unsupervised')
  • task (str) – one of 'regression', 'classification', or 'unsupervised'
  • force (bool) – create new experiment even if experiment with same name already exists
  • name (Optional[str]) – display name for experiment
Keyword Arguments:
 
  • accuracy (int) – accuracy setting [1-10]
  • time (int) – time setting [1-10]
  • interpretability (int) – interpretability setting [1-10]
  • scorer (Union[str,ScorerRecipe]) – metric to optimize for
  • models (Union[str,ModelRecipe]) – limit experiment to these models
  • transformers (Union[str,TransformerRecipe]) – limit experiment to these transformers
  • validation_dataset (Dataset) – Dataset object
  • test_dataset (Dataset) – Dataset object
  • weight_column (str) – name of column in train_dataset
  • fold_column (str) – name of column in train_dataset
  • time_column (str) – name of column in train_dataset, containing time ordering for timeseries problems
  • time_groups_columns (List[str]) – list of column names, contributing to time ordering
  • unavailable_at_prediction_time_columns (List[str]) – list of column names, which won’t be present at prediction time
  • drop_columns (List[str]) – list of column names to be dropped
  • enable_gpus (bool) – allow GPU usage in experiment
  • reproducible (bool) – set experiment to be reproducible. If seed value set and reproducible was not set it will be marked as true by the client.
  • time_period_in_seconds (int) – the length of the time period in seconds, used in timeseries problems
  • num_prediction_periods (int) – timeseries forecast horizon in time period units
  • num_gap_periods (int) – number of time periods after which forecast starts
  • config_overrides (str) – Driverless AI config overrides in TOML string format

Note

Any expert setting can also be passed as a kwarg. To search possible expert settings for your server version, use experiments.search_expert_settings(search_term).

Return type:Experiment
get(key: str) Experiment

Get an Experiment object corresponding to an experiment on the Driverless AI server. If the experiment only exists on H2O.ai Storage, it will be imported to the server first.

Parameters:key (str) – Driverless AI server’s unique ID for the experiment
Return type:Experiment
gui() Hyperlink

Get full URL for the experiments page on the Driverless AI server.

Return type:Hyperlink
import_dai_file(path: str) Experiment
Import a dai file to the Driverless AI server and return a
corresponding Experiment object.

Warning

Requires DriverlessAI server version 1.10.0 or higher.

Return type:Experiment
leaderboard(train_dataset: Dataset, target_column: Optional[str], task: str, force: bool = False, name: str = None, **kwargs: Any) Project
Launch an experiment leaderboard on the Driverless AI server and

return a project object to track experiment statuses. Requires server version >= 1.9.0.

Args:

train_dataset: Dataset object target_column: name of column in train_dataset

(pass None if task is 'unsupervised')

task: one of 'regression', 'classification', or 'unsupervised' force: create new project even if project with same name

already exists

name: display name for project

Keyword Args:

accuracy (int): accuracy setting [1-10] time (int): time setting [1-10] interpretability (int): interpretability setting [1-10] scorer (Union[str,ScorerRecipe]): metric to optimize for models (Union[str,ModelRecipe]): limit experiment to these models transformers (Union[str,TransformerRecipe]): limit experiment to

these transformers

validation_dataset (Dataset): Dataset object test_dataset (Dataset): Dataset object weight_column (str): name of column in train_dataset fold_column (str): name of column in train_dataset time_column (str): name of column in train_dataset,

containing time ordering for timeseries problems
time_groups_columns (List[str]): list of column names,
contributing to time ordering
unavailable_at_prediction_time_columns (List[str]):
list of column names, which won’t be present at prediction time

drop_columns (List[str]): list of column names to be dropped enable_gpus (bool): allow GPU usage in experiment reproducible (bool): set experiment to be reproducible time_period_in_seconds (int): the length of the time period in seconds,

used in timeseries problems
num_prediction_periods (int): timeseries forecast horizon in time
period units
num_gap_periods (int): number of time periods after which
forecast starts

config_overrides (str): Driverless AI config overrides in TOML string format

Note

Any expert setting can also be passed as a kwarg. To search possible expert settings for your server version, use experiments.search_expert_settings(search_term).

Warning

Requires DriverlessAI server version 1.9.0 or higher.

Return type:Project
list(start_index: int = 0, count: Optional[int] = None) Sequence[Experiment]

List of Experiment objects available to the user.

Parameters:
  • start_index (int) – index on Driverless AI server of first experiment in list
  • count (Optional[int]) – number of experiments to request from the Driverless AI server
Return type:

Sequence[Experiment]

preview(train_dataset: Dataset, target_column: Optional[str], task: str, force: Optional[bool] = None, name: Optional[str] = None, **kwargs: Any) None

Print a preview of experiment for the given settings.

Parameters:
  • train_dataset (Dataset) – Dataset object
  • target_column (Optional[str]) – name of column in train_dataset (pass None if task is 'unsupervised')
  • task (str) – one of 'regression', 'classification', or 'unsupervised'
  • force (Optional[bool]) – ignored (preview accepts the same arguments as create)
  • name (Optional[str]) – ignored (preview accepts the same arguments as create)
Keyword Arguments:
 
  • accuracy (int) – accuracy setting [1-10]
  • time (int) – time setting [1-10]
  • interpretability (int) – interpretability setting [1-10]
  • scorer (Union[str,ScorerRecipe]) – metric to optimize for
  • models (Union[str,ModelRecipe]) – limit experiment to these models
  • transformers (Union[str,TransformerRecipe]) – limit experiment to these transformers
  • validation_dataset (Dataset) – Dataset object
  • test_dataset (Dataset) – Dataset object
  • weight_column (str) – name of column in train_dataset
  • fold_column (str) – name of column in train_dataset
  • time_column (str) – name of column in train_dataset, containing time ordering for timeseries problems
  • time_groups_columns (List[str]) – list of column names, contributing to time ordering
  • unavailable_at_prediction_time_columns (List[str]) – list of column names, which won’t be present at prediction time
  • drop_columns (List[str]) – list of column names to be dropped
  • enable_gpus (bool) – allow GPU usage in experiment (True), to not allow GPU usage (False). If not set Driverless AI will decide whether CPU or GPU is best for the experiment
  • reproducible (bool) – set experiment to be reproducible
  • time_period_in_seconds (int) – the length of the time period in seconds, used in timeseries problems
  • num_prediction_periods (int) – timeseries forecast horizon in time period units
  • num_gap_periods (int) – number of time periods after which forecast starts
  • config_overrides (str) – Driverless AI config overrides in TOML string format

Note

Any expert setting can also be passed as a kwarg. To search possible expert settings for your server version, use experiments.search_expert_settings(search_term).

Return type:None
search_expert_settings(search_term: str, show_description: bool = False) None

Search expert settings and print results. Useful when looking for kwargs to use when creating experiments.

Parameters:
  • search_term (str) – term to search for (case-insensitive)
  • show_description (bool) – include description in results
Return type:

None

MLI

API Reference:

class MLI

Interact with MLI interpretations on the Driverless AI server.

create(experiment: Optional[Experiment] = None, dataset: Optional[Dataset] = None, name: Optional[str] = None, force: bool = False, **kwargs: Any) Interpretation

Create an MLI interpretation on the Driverless AI server and return an Interpretation object corresponding to the created interpretation.

Parameters:
  • experiment (Optional[Experiment]) – experiment to interpret, will use training dataset if dataset not specified
  • dataset (Optional[Dataset]) – dataset to use for interpretation (if dataset includes target and prediction columns, then an experiment is not needed)
  • name (Optional[str]) – display name for the interpretation
  • force (bool) – create new interpretation even if interpretation with same name already exists
Keyword Arguments:
 
  • explainers (List[ExplainerRecipe]) – list of explainer recipe objects
  • test_dataset (Dataset) – Dataset object (timeseries only)
  • target_column (str) – name of column in dataset
  • prediction_column (str) – name of column in dataset
  • weight_column (str) – name of column in dataset
  • drop_columns (List[str]) – names of columns in dataset

Note

Any expert setting can also be passed as a kwarg. To search possible expert settings for your server version, use mli.search_expert_settings(search_term).

Return type:Interpretation
create_async(experiment: Optional[Experiment] = None, dataset: Optional[Dataset] = None, name: Optional[str] = None, force: bool = False, validate_settings: bool = True, **kwargs: Any) Interpretation

Launch creation of an MLI interpretation on the Driverless AI server and return an Interpretation object to track the status.

Parameters:
  • experiment (Optional[Experiment]) – experiment to interpret, will use training dataset if dataset not specified
  • dataset (Optional[Dataset]) – dataset to use for interpretation (if dataset includes target and prediction columns, then an experiment is not needed)
  • name (Optional[str]) – display name for the interpretation
  • force (bool) – create new interpretation even if interpretation with same name already exists
Keyword Arguments:
 
  • explainers (List[ExplainerRecipe]) – list of explainer recipe objects (server versions >= 1.9.1)
  • test_dataset (Dataset) – Dataset object (timeseries only)
  • target_column (str) – name of column in dataset
  • prediction_column (str) – name of column in dataset
  • weight_column (str) – name of column in dataset
  • drop_columns (List[str]) – names of columns in dataset

Note

Any expert setting can also be passed as a kwarg. To search possible expert settings for your server version, use mli.search_expert_settings(search_term).

Return type:Interpretation
gui() Hyperlink

Print full URL for the user’s MLI page on Driverless AI server.

Return type:Hyperlink
property iid: driverlessai._mli.IIDMethods

Retrieve IID interpretations.

Return type:IIDMethods
search_expert_settings(search_term: str = '', show_description: bool = False, show_valid_values: bool = False) Table

Search expert settings and print results. Useful when looking for kwargs to use when creating interpretations.

Parameters:
  • search_term (str) – term to search for (case-insensitive)
  • show_description (bool) – include description in results
  • show_valid_values (bool) – include valid values that can be set for each setting in the results
Return type:

Table

property timeseries: driverlessai._mli.TimeseriesMethods

Retrieve timeseries interpretations.

Return type:TimeseriesMethods

Interpretation Retrieval Methods

class IIDMethods
get(key: str) Interpretation

Get an Interpretation object corresponding to an MLI interpretation on the Driverless AI server.

Parameters:key (str) – Driverless AI server’s unique ID for the MLI interpretation
Return type:Interpretation
list(start_index: int = 0, count: Optional[int] = None) Sequence[Interpretation]

List of Interpretation objects available to the user.

Parameters:
  • start_index (int) – index on Driverless AI server of first interpretation to list
  • count (Optional[int]) – max number of interpretations to request from the Driverless AI server
Return type:

Sequence[Interpretation]

class TimeseriesMethods
get(key: str) Interpretation

Get an Interpretation object corresponding to an MLI interpretation on the Driverless AI server.

Parameters:key (str) – Driverless AI server’s unique ID for the MLI interpretation
Return type:Interpretation
list(start_index: int = 0, count: Optional[int] = None) Sequence[Interpretation]

List of Interpretation objects available to the user.

Parameters:
  • start_index (int) – index on Driverless AI server of first interpretation to list
  • count (Optional[int]) – max number of interpretations to request from the Driverless AI server
Return type:

Sequence[Interpretation]

Model Diagnostics

API Reference:

class ModelDiagnostics

Interact with model diagnostics on the Driverless AI server.

create(diagnose_experiment: Experiment, test_dataset: Dataset) ModelDiagnostic

Create a new model diagnostic.

Parameters:
  • diagnose_experiment (Experiment) – experiment that created the diagnosing model
  • test_dataset (Dataset) – test dataset for the diagnosis
Return type:

ModelDiagnostic

create_async(diagnose_experiment: Experiment, test_dataset: Dataset) ModelDiagnosticJob

Launch creation of a new model diagnostic.

Parameters:
  • diagnose_experiment (Experiment) – experiment that created the diagnosing model
  • test_dataset (Dataset) – test dataset for the diagnosis
Return type:

ModelDiagnosticJob

get(key: str) ModelDiagnostic

Get a ModelDiagnostic object corresponding to a model diagnostic on the Driverless AI server.

Parameters:key (str) – Driverless AI server’s unique ID for the model diagnostic
Return type:ModelDiagnostic
gui() Hyperlink

Get full URL for the Model Diagnostics page on the Driverless AI server.

Return type:Hyperlink
list(start_index: int = 0, count: Optional[int] = None) Sequence[ModelDiagnostic]

Return list of ModelDiagnostic objects on the Driverless AI server.

Parameters:
  • start_index (int) – index on Driverless AI server of first model diagnostic in list
  • count (Optional[int]) – number of model diagnostics to request from the Driverless AI server
Return type:

Sequence[ModelDiagnostic]

class ModelDiagnostic

Interact with a model diagnostic on the Driverless AI server.

delete() None

Delete this model diagnostic on Driverless AI server.

Return type:None
download_predictions(dst_dir: str = '.', dst_file: Optional[str] = None, file_system: Optional[fsspec.spec.AbstractFileSystem] = None, overwrite: bool = False, timeout: float = 30) str

Downloads the predictions into a csv file.

Return type:str
property experiment: driverlessai._experiments.Experiment

Diagnosed experiment by this model diagnostic.

Return type:Experiment
gui() Hyperlink

Get full URL for this model diagnostic’s page on the Driverless AI server.

Return type:Hyperlink
property key: str

Universally unique identifier.

Return type:str
property metric_plots: driverlessai._model_diagnostics.ModelDiagnosticMetricPlots

Metric plots of this model diagnostic.

Warning

Requires DriverlessAI server version 1.9.0 or higher.

Warning

A beta API that is subject to future changes.

Return type:ModelDiagnosticMetricPlots
property name: str

Display name.

Return type:str
property scores: Dict[str, Dict[str, float]]

Scores of this model diagnostic.

Return type:Dict[str, Dict[str, float]]
property test_dataset: driverlessai._datasets.Dataset

Test dataset that was used for this model diagnostic.

Return type:Dataset
class ModelDiagnosticMetricPlots

Interacts with metric plots of a model diagnostic on the Driverless AI server.

property actual_vs_predicted_chart: Optional[Dict[str, Any]]

Actual vs predicted Chart of this model diagnostic.

Return type:Optional[Dict[str, Any]]
Returns:an actual vs predicted chart in Vega Lite (v3) format
confusion_matrix(threshold: Optional[float] = None) Optional[List[List[Any]]]

Confusion Matrix of this model diagnostic.

Parameters:threshold (Optional[float]) – a threshold value
Return type:Optional[List[List[Any]]]
Returns:the confusion matrix as a 2D list
property gains_chart: Optional[Dict[str, Any]]

Cumulative Gain Chart of this model diagnostic.

Return type:Optional[Dict[str, Any]]
Returns:a gains chart in Vega Lite (v3) format
property ks_chart: Optional[Dict[str, Any]]

Kolmogorov-Smirnov Chart of this model diagnostic.

Return type:Optional[Dict[str, Any]]
Returns:a Kolmogorov-Smirnov chart in Vega Lite (v3) format
property lift_chart: Optional[Dict[str, Any]]

Lift Chart of this model diagnostic.

Return type:Optional[Dict[str, Any]]
Returns:a lift chart in Vega Lite (v3) format
property prec_recall_curve: Optional[Dict[str, Any]]

Precision-Recall Curve of this model diagnostic.

Return type:Optional[Dict[str, Any]]
Returns:a precision-recall chart in Vega Lite (v3) format
property residual_histogram: Optional[Dict[str, Any]]

Residual Histogram of this model diagnostic.

Return type:Optional[Dict[str, Any]]
Returns:a residual histogram in Vega Lite (v3) format
property residual_plot: Optional[Dict[str, Any]]

Residual Plot with LOESS Curve of this model diagnostic.

Return type:Optional[Dict[str, Any]]
Returns:a residual plot in Vega Lite (v3) format
property roc_curve: Optional[Dict[str, Any]]

ROC Curve of this model diagnostic.

Return type:Optional[Dict[str, Any]]
Returns:a ROC curve in Vega Lite (v3) format

Projects

API Reference:

class Projects

Interact with projects on the Driverless AI server.

create(name: str, description: Optional[str] = None, force: bool = False) Project

Create a project on the Driverless AI server.

Parameters:
  • name (str) – display name for project
  • description (Optional[str]) – description of project
  • force (bool) – create new project even if project with same name already exists
Return type:

Project

get(key: str) Project

Get a Project object corresponding to a project on the Driverless AI server.

Parameters:key (str) – Driverless AI server’s unique ID for the project
Return type:Project
gui() Hyperlink

Get full URL for the projects page on the Driverless AI server.

Return type:Hyperlink
list(start_index: int = 0, count: Optional[int] = None) Sequence[Project]

List of Project objects available to the user.

Parameters:
  • start_index (int) – index on Driverless AI server of first project in list
  • count (Optional[int]) – number of projects to request from the Driverless AI server
Return type:

Sequence[Project]

Recipes

API Reference:

class Recipes

Create and interact with recipes on the Driverless AI server.

create(recipe: str, username: Optional[str] = None, password: Optional[str] = None) Recipe

Create a recipe on the Driverless AI server.

Parameters:
  • recipe (str) – path or URL to the recipe
  • username (Optional[str]) – username to use when connecting to BitBucket
  • password (Optional[str]) – password to use when connecting to BitBucket

Examples:

dai.recipes.create(
    recipe='https://github.com/h2oai/driverlessai-recipes/blob/master/scorers/regression/explained_variance.py'
)
Return type:Recipe
create_async(recipe: str, username: Optional[str] = None, password: Optional[str] = None) RecipeJob

Launch creation of a recipe on the Driverless AI server.

Parameters:
  • recipe (str) – path or URL to the recipe
  • username (Optional[str]) – username to use when connecting to BitBucket
  • password (Optional[str]) – password to use when connecting to BitBucket

Examples:

dai.recipes.create_async(
    recipe='https://github.com/h2oai/driverlessai-recipes/blob/master/scorers/regression/explained_variance.py'
)
Return type:RecipeJob
property data: driverlessai._recipes.DataRecipes

See data recipes on the Driverless AI server.

Warning

Requires DriverlessAI server version 1.10.0 or higher.

Return type:DataRecipes
property explainers: driverlessai._recipes.ExplainerRecipes

See explainer recipes on the Driverless AI server.

Warning

Requires DriverlessAI server version 1.9.1 or higher.

Return type:ExplainerRecipes
property individuals: driverlessai._recipes.IndividualRecipes

See individual recipes on the Driverless AI server.

Warning

Requires DriverlessAI server version 1.10.2 or higher.

Return type:IndividualRecipes
property models: driverlessai._recipes.ModelRecipes

See model recipes on the Driverless AI server.

Return type:ModelRecipes
property pre_transformers: driverlessai._recipes.PreTransformerRecipes

See pre-transformer recipes on the Driverless AI server.

Warning

Requires DriverlessAI server version 1.9.0 or higher.

Return type:PreTransformerRecipes
property scorers: driverlessai._recipes.ScorerRecipes

See scorer recipes on the Driverless AI server.

Return type:ScorerRecipes
property transformers: driverlessai._recipes.TransformerRecipes

See transformer recipes on the Driverless AI server.

Return type:TransformerRecipes
class ExplainerRecipes

Interact with explainer recipes on the Driverless AI server.

Examples:

# Get list of names of all explainers
[e.name for e in dai.recipes.explainers.list()]
list() Sequence[ExplainerRecipe]

Return list of explainer recipe objects.

Examples:

dai.recipes.explainer.list()
Return type:Sequence[ExplainerRecipe]
class ModelRecipes

Interact with model recipes on the Driverless AI server.

Examples:

# Get list of all custom models
[m for m in dai.recipes.models.list() if m.is_custom]

# Get list of names of all models
[m.name for m in dai.recipes.models.list()]
list() Sequence[ModelRecipe]

Return list of model recipe objects.

Examples:

dai.recipes.models.list()
Return type:Sequence[ModelRecipe]
class ScorerRecipes

Interact with scorer recipes on the Driverless AI server.

Examples:

# Retrieve a list of binomial scorers
[s for s in dai.recipes.scorers.list() if s.for_binomial]

# Retrieve a list of multiclass scorers
[s for s in dai.recipes.scorers.list() if s.for_multiclass]

# Retrieve a list of regression scorers
[s for s in dai.recipes.scorers.list() if s.for_regression]

# Get list of all custom scorers
[s for s in dai.recipes.scorers.list() if s.is_custom]

# Get list of names of all scorers
[s.name for s in dai.recipes.scorers.list()]

# Get list of descriptions for all scorers
[s.description for s in dai.recipes.scorers.list()]
list() Sequence[ScorerRecipe]

Return list of scorer recipe objects.

Examples:

dai.recipes.scorers.list()
Return type:Sequence[ScorerRecipe]
class TransformerRecipes

Interact with transformer recipes on the Driverless AI server.

Examples:

# Get list of all custom transformers
[m for m in dai.recipes.transformers.list() if m.is_custom]

# Get list of names of all transformers
[m.name for m in dai.recipes.transformers.list()]
list() Sequence[TransformerRecipe]

Return list of transformer recipe objects.

Examples:

dai.recipes.transformers.list()
Return type:Sequence[TransformerRecipe]

Get Information about the Server

The following attribute of a connected client allows you to get information about the Driverless AI server.

Server

API Reference:

class Server

Get information about the Driverless AI server.

Examples:

# Connect to the DAI server
dai = driverlessai.Client(
    address='http://localhost:12345',
    username='py',
    password='py'
)

dai.server.address
dai.server.username
dai.server.version
property address: str

URL of the Driverless AI server connected to.

Return type:str
property cpu_usages: List[float]

Get usage of each CPU of the Driverless AI server.

Warning

Requires DriverlessAI server version 1.10.6 or higher.

Warning

A beta API that is subject to future changes.

Return type:List[float]
property disk_usage: Dict[str, int]

Get disk usage(in bytes) of the Driverless AI server.

Return type:Dict[str, int]
docs(search: Optional[str] = None) Hyperlink

Get link to documentation on the Driverless AI server.

Parameters:search (Optional[str]) – if search terms are supplied, the link will go to documentation search results

Example:

# Search the DAI docs for "licenses"
dai.server.docs(search='licenses')
Return type:Hyperlink
property experiment_stats: Dict[str, int]

Get experiments related statistics of the Driverless AI server.

Return type:Dict[str, int]
property gpu_usages: List[Dict[str, float]]

Get GPU statistics of the Driverless AI server.

Return type:List[Dict[str, float]]
gui() Hyperlink

Get full URL for the Driverless AI server.

Examples:

dai.server.gui()
Return type:Hyperlink
property license: driverlessai._server.License

Get information about the license on the Driverless AI server.

Return type:License
property memory_usage: Dict[str, int]

Get memory statistics(in bytes) of the Driverless AI server.

Warning

Requires DriverlessAI server version 1.10.6 or higher.

Return type:Dict[str, int]
property storage_enabled: bool

Whether the Driverless AI server is connected to H2O.ai Storage.

Return type:bool
property username: str

Current user connected as to a Driverless AI server.

Return type:str
property version: str

Version of Driverless AI server currently connected to.

Return type:str
property workers: List[Dict[str, Any]]

Get statistics each worker of the Driverless AI server.

Warning

Requires DriverlessAI server version 1.9.0.6 or higher.

Warning

A beta API that is subject to future changes.

Return type:List[Dict[str, Any]]
class License

Get information about the Driverless AI server’s license.

days_left() int

Return days left on license.

Examples:

dai.server.license.days_left()
Return type:int
is_valid() bool

Return True if server is licensed.

Examples:

dai.server.license.is_valid()
Return type:bool