top-level utility functions for common operations such as key generation, epoch parsing and local model prediction.
Functions
api()
create a WizataDSAPIClient from environment variables. This is the recommended way to create a client.
return: WizataDSAPIClient instance.
import wizata_dsapi
client = wizata_dsapi.api()
client.info()generate_unique_key()
generate a unique key for experiment, pipeline, model, template or other entities. The key is a human-readable combination of date, color and animal.
return: unique key string.
import wizata_dsapi
key = wizata_dsapi.generate_unique_key()
# e.g. '0218_red_penguin_042'generate_epoch()
generate an epoch timestamp in milliseconds based on a relative datetime string (e.g. now+6h, now-7d).
| Name | Type | Default | Description |
|---|---|---|---|
| formatted_string | str | formatted epoch representation using relative time (e.g. 'now-7d', 'now+6h'). | |
| now | None | override the current datetime (defaults to datetime.now(timezone.utc)). | |
| return: epoch in milliseconds. |
Supported units: y = 365d, M = 30d, w = 7d, d = 24h, h = 60m, m = 60s, s = 1000ms.
import wizata_dsapi
epoch_ms = wizata_dsapi.generate_epoch("now-7d")verify_relative_datetime()
verify if a string matches the supported relative datetime format (e.g. now-7d, now+6h).
| Name | Type | Default | Description |
|---|---|---|---|
| formatted_string | str | string to verify. | |
| return: True if format is valid, False otherwise. |
predict()
execute a machine learning model locally on a dataframe.
| Name | Type | Default | Description |
|---|---|---|---|
| df | pandas.DataFrame | dataframe to use as input. | |
| model_info | ModelInfo | model information handler (must have trained_model loaded). | |
| mapping_table | None | optional mapping table for column renaming. | |
| return: output dataframe with predicted values. |
import wizata_dsapi
model = wizata_dsapi.api().download_model("my_model")
result = wizata_dsapi.predict(df, model)