Datasets
Upload, manage, and explore datasets.
All methods are accessed via client.datasets.
list_datasets()
List all available public datasets.
Returns
list — List of dataset names
Example
load_dataset()
Load a public dataset by name. Downloads the CSV directly from the xplainable public blob storage. Known datasets: telco_churn, titanic, heart_disease, iris
Parameters
Returns
DataFrame — DataFrame containing the dataset
Example
upload_dataset()
Upload a dataset from inline JSON records. Accepts inline records (list of row dicts) so it works from remote callers such as the hosted MCP server — no file paths.
Parameters
NoneNoneReturns
DatasetUploadResponse — Upload response with dataset information
Example
upload_dataset_file()
Upload a dataset from a local file.
Parameters
NoneNoneReturns
DatasetUploadResponse — Upload response with dataset information
Example
delete_dataset()
Delete a dataset.
Parameters
Returns
dict — Success message
Example
get_dataset_info()
Get information about a specific dataset.
Parameters
Returns
DatasetInfo — Dataset information
Example
preview_dataset()
Preview a window or random sample of a dataset.
Parameters
100FalseReturns
DataFrame — DataFrame with preview data
Example
preview_dataset_json()
Preview a dataset as JSON records. The default is a head window. Datasets are often ordered (e.g. by the target), so a head window can be badly biased — pass sample=True to see a representative slice, or page with offset.
Parameters
100FalseReturns
list — List of row dicts (JSON records)
Example
list_team_datasets()
List all datasets for a team.
Parameters
NoneReturns
list — List of dataset information
Example
get_relationships()
Read the dataset's declared feature relationships. Relationships are the things the model cannot see feature by feature: derived columns (EstimatedLifetimeCharges = tenure * MonthlyCharges), implications between categorical features (InternetService=No implies every add-on is No) and confirmed monotonic directions. They are declared once per dataset and copied into every model trained on it, where the optimiser enforces them.
Parameters
Returns
dict — Dict with revision, updated_by, updated, derived, implies, infeasible, monotonic, notes. revision 0 means nothing declared.
Example
infer_relationships()
Propose feature relationships from the data, with evidence. Scans up to 50k rows and returns candidates for the agent to review before committing with set_relationships — nothing is stored: - implies: category pairs that never co-occur (parent level with at least 30 rows), each with support and the never-seen values; - derived: numeric columns that equal an arithmetic combination of two others (a * b, a + b, a - b, a / b) to 1e-6; - monotonic_hints: numeric features whose Spearman correlation with the target exceeds 0.3 in magnitude (hints only — confirm from domain knowledge before declaring); - existing: the current declaration.
Parameters
NoneReturns
dict
Example
set_relationships()
Declare (replace) the dataset's feature relationships. Validated against the data before it is stored: columns and categories must exist, every derived expression must evaluate (pandas-eval syntax, backticks for names with spaces), and an implication must actually forbid something. The declaration is copied into every model trained afterwards; existing versions pick it up with models.apply_relationships.
Parameters
NoneNoneNoneNoneNoneReturns
dict — Dict with the stored relationships (new revision), the compiled rules and any warnings (e.g. a derived expression that does not reproduce the stored column).