Skip to main content

Task 1: Set up authentication and access H2O DAI Engine

In this step, you will set up authentication and access H2O Driverless AI (DAI) engine. By completing this task, you will establish a secure connection to the DAI environment, enabling you to load datasets, train models, and run experiments.

Authentication ensures that only authorized users can interact with the DAI engine. This is essential for:

  • Loading the dataset required for credit default prediction
  • Training and tuning machine learning models
  • Running experiments and interpreting results securely and efficiently

Authenticate using h2osteam

The following code demonstrates how to authenticate with h2osteam:

import h2osteam
from h2osteam.clients import DriverlessClient

h2osteam.login(url="", username="", password="")
dai = DriverlessClient().get_instance("").connect(use_own_client=True)
  • h2osteam.login(): Logs into the HAIC environment. Replace the placeholders with your server URL, username, and password.
  • get_instance(): Retrieves the specific engine instance.
  • connect(): Establishes a connection to the engine and allows you to perform operations.

For more information on obtaining a personal access token (which serves as the password) and other login details, refer to the Getting Started section on H2O Enterprise Steam documentation.

Authenticate using driverlessai

For on-premises deployments, use the driverlessai library as shown below:

import driverlessai

dai = driverlessai.Client(address="", username="", password="")
  • driverlessai.Client: Creates a client instance to interact with the on-prem Driverless AI server. Provide the address, username, and password for authentication.

Authenticate using h2o_engine_manager

import h2o_engine_manager
import pandas as pd
dai_engine_client = h2o_engine_manager.login().dai_engine_client

engine = dai_engine_client.get_engine(
workspace_id="default",
engine_id="new-dai-engine-6265"
)

dai = engine.connect()
  • h2o_engine_manager.login(): Authenticates the user and returns a client object.
  • get_engine(): Fetches the specific engine instance based on the workspace_id and engine_id. Ensure these match your setup.
  • connect(): Establishes a connection to the selected engine and provides access to datasets, and experiments.

For more information about the available authentication options for h2o_engine_manager, see Initialization section of the H2O AI Engine Manager documentation.


Feedback