Skip to content

client

DatasetUIDCacheManager

Manages a cache of the last 50 uploaded datasets, tracking dataset hashes and their UIDs.

add_dataset_uid

add_dataset_uid(hash: str, dataset_uid: str)

Adds a new dataset to the cache, removing the oldest item if the cache exceeds 50 entries. Assumes the dataset is not already in the cache.

delete_uid

delete_uid(dataset_uid: str) -> Optional[str]

Deletes an entry from the cache based on the dataset UID.

get_dataset_uid

get_dataset_uid(*args)

Generates hash by all received arguments and returns cached dataset uid if in cache, otherwise None.

load_cache

load_cache()

Loads the cache from disk if it exists, otherwise initializes an empty cache.

save_cache

save_cache()

Saves the current cache to disk.

GCPOverloaded

Bases: Exception

Exception raised when the Google Cloud Platform service is overloaded or unavailable.

ServiceClient

Bases: Singleton

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

delete_all_datasets classmethod

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_dataset classmethod

delete_dataset(dataset_uid: str) -> list[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.

download_all_data classmethod

download_all_data(save_dir: Path) -> Union[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.

fit classmethod

fit(X, y, config=None) -> 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. config : dict, optional Configuration for the fit method. Includes tabpfn_systems and paper_version.

Returns

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

get_data_summary classmethod

get_data_summary() -> dict

Get the data summary of the user from the server.

Returns

data_summary : dict The data summary returned from the server.

get_password_policy classmethod

get_password_policy() -> dict

Get the password policy from the server.

Returns

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

is_auth_token_outdated classmethod

is_auth_token_outdated(access_token) -> Union[bool, None]

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

login classmethod

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.

predict classmethod

predict(
    train_set_uid: str,
    x_test,
    task: Literal["classification", "regression"],
    predict_params: Union[dict, None] = None,
    tabpfn_config: Union[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.

register classmethod

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.

retrieve_greeting_messages classmethod

retrieve_greeting_messages() -> list[str]

Retrieve greeting messages that are new for the user.

send_reset_password_email classmethod

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

Let the server send an email for resetting the password.

send_verification_email classmethod

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

Let the server send an email for verifying the email.

try_browser_login classmethod

try_browser_login() -> tuple[bool, str]

Attempts browser-based login flow Returns (success: bool, message: str)

try_connection classmethod

try_connection() -> bool

Check if server is reachable and accepts the connection.

validate_email classmethod

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.

verify_email classmethod

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

Verify the email with the provided token.

Parameters

token : str access_token : str

Returns

is_verified : bool True if the email is verified successfully. message : str The message returned from the server.