Skip to content

ServiceClient

Singleton class for handling communication with the server. It encapsulates all the API calls to the server.

access_token property

access_token

is_initialized property

is_initialized

__init__

__init__()

authorize

authorize(access_token: str)

reset_authorization

reset_authorization()

upload_train_set

upload_train_set(X, y) -> str

Upload a train set to server and return the train set UID if successful.

Parameters

X : array-like of shape (n_samples, n_features) The training input samples. y : array-like of shape (n_samples,) or (n_samples, n_outputs) The target values.

Returns

train_set_uid : str The unique ID of the train set in the server.

predict

predict(
    train_set_uid: str,
    x_test,
    task: Literal["classification", "regression"],
    tabpfn_config: dict | None = None,
    X_train=None,
    y_train=None,
) -> dict[str, ndarray]

Predict the class labels for the provided data (test set).

Parameters

train_set_uid : str The unique ID of the train set in the server. x_test : array-like of shape (n_samples, n_features) The test input.

Returns

y_pred : array-like of shape (n_samples,) The predicted class labels.

try_connection

try_connection() -> bool

Check if server is reachable and accepts the connection.

is_auth_token_outdated

is_auth_token_outdated(access_token) -> bool | None

Check if the provided access token is valid and return True if successful.

validate_email

validate_email(email: str) -> tuple[bool, str]

Send entered email to server that checks if it is valid and not already in use.

Parameters

email : str

Returns

is_valid : bool True if the email is valid. message : str The message returned from the server.

register

register(
    email: str,
    password: str,
    password_confirm: str,
    validation_link: str,
    additional_info: dict,
)

Register a new user with the provided credentials.

Parameters

email : str password : str password_confirm : str validation_link: str additional_info : dict

Returns

is_created : bool True if the user is created successfully. message : str The message returned from the server.

login

login(email: str, password: str) -> tuple[str, str]

Login with the provided credentials and return the access token if successful.

Parameters

email : str password : str

Returns

access_token : str | None The access token returned from the server. Return None if login fails. message : str The message returned from the server.

get_password_policy

get_password_policy() -> {}

Get the password policy from the server.

Returns

password_policy : {} The password policy returned from the server.

send_reset_password_email

send_reset_password_email(email: str) -> tuple[bool, str]

Let the server send an email for resetting the password.

send_verification_email

send_verification_email(
    access_token: str,
) -> tuple[bool, str]

Let the server send an email for verifying the email.

retrieve_greeting_messages

retrieve_greeting_messages() -> list[str]

Retrieve greeting messages that are new for the user.

get_data_summary

get_data_summary() -> {}

Get the data summary of the user from the server.

Returns

data_summary : {} The data summary returned from the server.

download_all_data

download_all_data(save_dir: Path) -> Path | None

Download all data uploaded by the user from the server.

Returns

save_path : Path | None The path to the downloaded file. Return None if download fails.

delete_dataset

delete_dataset(dataset_uid: str) -> [str]

Delete the dataset with the provided UID from the server. Note that deleting a train set with lead to deleting all associated test sets.

Parameters

dataset_uid : str The UID of the dataset to be deleted.

Returns

deleted_dataset_uids : [str] The list of deleted dataset UIDs.

delete_all_datasets

delete_all_datasets() -> [str]

Delete all datasets uploaded by the user from the server.

Returns

deleted_dataset_uids : [str] The list of deleted dataset UIDs.

delete_user_account

delete_user_account(confirm_pass: str) -> None