Skip to main content
Version: Next

Models

Create, manage, and load machine learning models.

All methods are accessed via client.models.

create_model()

POST/v1/models/create

Create a new model.

Parameters

modelRequired
The XClassifier or XRegressor model
model_namestrRequired
Name of the model
model_descriptionstrRequired
Description of the model
xDataFrameRequired
Feature matrix
ySeriesRequired
Target variable
run_idstrdefault: None
Optional run ID to associate with the model

Returns

tuple — Tuple of (model_id, version_id)

Example

1result = client.models.create_model(
2 model=model,
3 model_name="My Model",
4 model_description="Predicts customer churn",
5 x=X_train,
6 y=y_train,
7 run_id="run_abc123"
8)

add_version()

POST/v1/models/add-version

Add a new version to an existing model.

Parameters

modelRequired
The XClassifier or XRegressor model
model_idstrRequired
ID of the existing model
xDataFrameRequired
Feature matrix
ySeriesRequired
Target variable

Returns

str — The new version_id

Example

1result = client.models.add_version(
2 model=model,
3 model_id="model_abc123",
4 x=X_train,
5 y=y_train
6)

list_team_models()

GET/v1/models/teams/{team_id}

List all models for the current team (based on API key). This method returns comprehensive information about all models accessible to the authenticated user's team.

Returns

list — List of model information including names, descriptions, and metadata

Example

1result = client.models.list_team_models()

get_model()

GET/v1/models/{model_id}

Get detailed information about a model.

Parameters

model_idstrRequired
ID of the model

Returns

ModelInfo — Model information

Example

1result = client.models.get_model(
2 model_id="model_abc123"
3)

list_model_versions()

GET/v1/models/versions/{model_id}

List all versions of a model.

Parameters

model_idstrRequired
ID of the model

Returns

list — List of model versions

Example

1result = client.models.list_model_versions(
2 model_id="model_abc123"
3)

list_model_version_partitions()

GET/v1/models/partitions/{version_id}

List all partitions for a model version.

Parameters

version_idstrRequired
ID of the model version (or "latest")

Returns

dict — Dictionary containing partition information

Example

1result = client.models.list_model_version_partitions(
2 version_id="version_xyz789"
3)

PUT/v1/preprocessors/link-preprocessor

Link a model version to a preprocessor version.

Parameters

model_version_idstrRequired
The model version ID
preprocessor_version_idstrRequired
The preprocessor version ID

Returns

None

Example

1result = client.models.link_preprocessor(
2 model_version_id="version_xyz789",
3 preprocessor_version_id="ppv_xyz789"
4)

train_model()

Train an xplainable model on a dataset and upload it to the platform. Provide ONE of: dataset_id (preferred for hosted MCP), file_path (local CSV), dataset_name (xplainable public dataset), or csv_content (raw CSV string).

Parameters

target_columnstrRequired
Name of the column to predict.
model_namestrRequired
Name for the uploaded model.
model_descriptionstrdefault: ''
Description for the uploaded model.
file_pathstrdefault: None
Path to a local CSV file.
dataset_namestrdefault: None
Name of an xplainable public dataset (e.g. "telco_churn").
dataset_idstrdefault: None
ID of a dataset already on the xplainable platform. Use datasets_list_team_datasets to find available IDs. This is the preferred method for hosted/remote MCP servers.
csv_contentstrdefault: None
Raw CSV string for when file paths aren't accessible.
model_typestrdefault: 'classifier'
Either "classifier" or "regressor".
partition_onstrdefault: None
Optional column name to partition on. Trains a separate sub-model per unique value in this column (e.g. partition_on="Industry" trains one model per industry). The column stays in the data for routing predictions but each partition gets its own tuned model.
preprocessor_version_idstrdefault: None
Optional preprocessor version ID to load and apply a fitted pipeline to the features before training.
drop_columnslistdefault: None
Optional list of column names to exclude from features.
test_sizefloatdefault: 0.2
Fraction of data to hold out for testing (0 to 1).
max_depthintdefault: 8
Maximum depth of the model decision tree.
min_info_gainfloatdefault: 0.0001
Minimum information gain required to split.
min_leaf_sizefloatdefault: 0.0001
Minimum leaf size as a fraction of training data.
weightfloatdefault: 1.0
Model weight parameter.
power_degreefloatdefault: 1.0
Power degree parameter.
sigmoid_exponentfloatdefault: 0.0
Sigmoid exponent parameter.
tail_sensitivityfloatdefault: 1.0
Tail sensitivity parameter.

Returns

dict — Dictionary with model_id, version_id, train/test metrics, feature_importances, and train/test sample counts.

Example

1result = client.models.train_model(
2 target_column="target",
3 model_name="My Model",
4 model_description="Predicts customer churn",
5 file_path="./data.csv",
6 dataset_name="...",
7 dataset_id="ds_abc123"
8)

refit_model()

POST/v1/models/versions/{version_id}/refit

Rapidly refit an existing model with new parameters without retraining. Everything happens server-side in a single API call -- data never leaves the platform. Orders of magnitude faster than train_model. Two modes: 1. Same params for features: set max_depth, weight, etc. directly. Use 'features' to target specific features, or omit for all. 2. Per-feature params: pass feature_params dict to tune each feature independently in one call. e.g.: feature_params={"Tenure Months": {"max_depth": 3}, "Contract": {"max_depth": 5}}

Parameters

version_idstrRequired
ID of the model version to refit.
dataset_idstrRequired
ID of the dataset on the platform.
target_columnstrRequired
Name of the target column.
featureslistdefault: None
List of feature names to update (mode 1). Defaults to all.
feature_paramsdictdefault: None
Per-feature params dict (mode 2). Keys are feature names, values are dicts of params. Overrides features/params. e.g. {"Tenure": {"max_depth": 3}, "Charges": {"max_depth": 5}}
drop_columnslistdefault: None
Columns to drop (same as in original training).
test_sizefloatdefault: 0.2
Test split fraction (same as original training).
max_depthintdefault: None
New max depth (mode 1, None = keep current).
min_info_gainfloatdefault: None
New min info gain (mode 1, None = keep current).
min_leaf_sizefloatdefault: None
New min leaf size (mode 1, None = keep current).
weightfloatdefault: None
New weight (mode 1, None = keep current).
power_degreefloatdefault: None
New power degree (mode 1, None = keep current).
sigmoid_exponentfloatdefault: None
New sigmoid exponent (mode 1, None = keep current).
tail_sensitivityfloatdefault: None
New tail sensitivity (mode 1, None = keep current).

Returns

dict — Dictionary with new version_id, train/test metrics, feature_importances, and the parameters that were changed.

Example

1result = client.models.refit_model(
2 version_id="version_xyz789",
3 dataset_id="ds_abc123",
4 target_column="target",
5 features=[],
6 feature_params={},
7 drop_columns=["id_col"]
8)

get_model_profile()

GET/v1/models/profile/{version_id}

Get the model profile showing feature contributions and decision boundaries.

Parameters

version_idstrRequired
ID of the model version.

Returns

dict — Dictionary containing the model profile data.

Example

1result = client.models.get_model_profile(
2 version_id="version_xyz789"
3)

get_model_evaluation()

GET/v1/models/evaluation/{partition_id}

Get detailed evaluation metrics for a model partition.

Parameters

partition_idstrRequired
ID of the model partition.

Returns

dict — Dictionary containing evaluation metrics.

Example

1result = client.models.get_model_evaluation(
2 partition_id="..."
3)

get_feature_info()

GET/v1/models/feature-info/{version_id}

Get feature information including types, health metrics, and distributions.

Parameters

version_idstrRequired
ID of the model version.

Returns

dict — Dictionary containing feature information.

Example

1result = client.models.get_feature_info(
2 version_id="version_xyz789"
3)