Spavik
API referenceModels

Evaluate a dataset

POST /v1/datasets/evaluate

Download OpenAPI
POST
/v1/datasets/evaluate

Authorization

apiKey
headerX-Spavik-Api-Key<token>

Spavik integration API key (sk-spv-api-...), sent in X-Spavik-Api-Key.

Header Parameters

User-Agent?string

Information about the agent originating the request, when known. Browsers supply their own value. Optional diagnostic metadata, declared by the caller and never used for authorization. Omit unknown values. Values are trimmed and truncated to the documented length.

Lengthlength <= 1024
X-Spavik-Client-Name?string

HTTP caller: SDK, MCP server or direct application (for example spavik-sdk-python, spavik-sdk-javascript or spavik-mcp). Optional diagnostic metadata, declared by the caller and never used for authorization. Omit unknown values. Values are trimmed and truncated to the documented length.

Lengthlength <= 128
X-Spavik-Client-Version?string

Version of that SDK, MCP server or direct application. Optional diagnostic metadata, declared by the caller and never used for authorization. Omit unknown values. Values are trimmed and truncated to the documented length.

Lengthlength <= 64

Request Body

  1. body
target*string
task?string

Inferred from the target values when omitted.

Value in"classification""regression"
max_samples?integer

Context rows requested for the trial. Capped by the plan (limits.max_context_rows in GET /v1/plans), never refused.

Range1 <= value
explain?boolean

Also rank every feature column by how much the trial score drops when its values are shuffled (trial.feature_importance). Off by default: it runs one extra prediction per column, so the call takes noticeably longer on wide tables. Use it to choose which columns to keep.

data*array<>

Data rows, one object per row.

Response Body

Success

application/json
  1. response
target?string
task?string
Value in"classification""regression"
n_rows?integer
columns?array<string>
validation?
assessment*

The single API conclusion, always present and non-null in HTTP 200 responses, including when the trial cannot run. Forward status, metric and message without recomputing them from scores. An absent or null assessment is a contract violation, not an inconclusive result. This is a descriptive comparison on the evaluated observations: better means strictly better than every required reference; equality is not better. No fixed gain or sample-size threshold implies significance. Inconclusive means missing or invalid evidence, or a skipped backtest; not_evaluated means validation prevented the trial. No status establishes reliability, future performance or absence of predictive signal.

hint?string

The first thing to fix, taken from the most serious issue.

trial?

What the engine makes of the data. Null when validation failed.

import requestsurl = "https://api.spavik.co/v1/datasets/evaluate"body = """{  "target": "churn",  "data": [    {      "plan": "pro",      "seats": 12,      "tickets_90d": 3,      "churn": 0    },    {      "plan": "free",      "seats": 1,      "tickets_90d": 9,      "churn": 1    },    {      "plan": "pro",      "seats": 40,      "tickets_90d": 0,      "churn": 0    },    {      "plan": "free",      "seats": 2,      "tickets_90d": 7,      "churn": 1    },    {      "plan": "growth",      "seats": 120,      "tickets_90d": 1,      "churn": 0    },    {      "plan": "free",      "seats": 1,      "tickets_90d": 12,      "churn": 1    },    {      "plan": "pro",      "seats": 25,      "tickets_90d": 2,      "churn": 0    },    {      "plan": "free",      "seats": 3,      "tickets_90d": 5,      "churn": 1    },    {      "plan": "growth",      "seats": 80,      "tickets_90d": 4,      "churn": 0    },    {      "plan": "pro",      "seats": 8,      "tickets_90d": 11,      "churn": 1    },    {      "plan": "growth",      "seats": 200,      "tickets_90d": 0,      "churn": 0    },    {      "plan": "free",      "seats": 4,      "tickets_90d": 2,      "churn": 0    }  ]}"""response = requests.request("POST", url, data = body, headers = {  "Content-Type": "application/json"})print(response.text)
{  "target": "string",  "task": "classification",  "n_rows": 0,  "columns": [    "string"  ],  "validation": {},  "assessment": {    "status": "better_than_baseline",    "metric": "AUC",    "message": "string"  },  "hint": "string",  "trial": {    "engine": "string",    "metrics": {      "AUC": 0,      "Accuracy": 0,      "AveragePrecision": 0,      "LogLoss": 0,      "MacroF1": 0,      "MAE": 0,      "RMSE": 0,      "R²": 0,      "MASE": 0,      "Bias": 0,      "BiasRatio": 0,      "Pinball": 0,      "property1": 0,      "property2": 0    },    "classification_report": {      "evaluated_count": 0,      "decision_rule": {        "kind": "argmax",        "description": "string",        "class_order": [          "string"        ],        "threshold": 0,        "tie_break": "first_in_class_order"      },      "per_class": [        {          "class": "string",          "support": 0,          "predicted_count": 0,          "true_positive": 0,          "precision": 0,          "recall": 0,          "f1": 0,          "undefined_reasons": {            "precision": "no_predicted_samples",            "recall": "no_actual_samples",            "f1": "no_actual_or_predicted_samples"          }        }      ]    },    "calibration": {      "available": true,      "unavailable_reason": "no_evaluated_samples",      "evaluated_count": 0,      "evaluated_on": "test",      "kind": "one_vs_rest",      "interpretation": "descriptive_only",      "binning": "uniform",      "n_bins": 10,      "bin_boundaries": "left_closed_right_open_last_closed",      "per_class": [        {          "class": "string",          "bins": [            {              "lower": 0,              "upper": 0,              "count": 0,              "positive_count": 0,              "mean_predicted_probability": 0,              "observed_frequency": 0            },            {              "lower": 0,              "upper": 0,              "count": 0,              "positive_count": 0,              "mean_predicted_probability": 0,              "observed_frequency": 0            },            {              "lower": 0,              "upper": 0,              "count": 0,              "positive_count": 0,              "mean_predicted_probability": 0,              "observed_frequency": 0            },            {              "lower": 0,              "upper": 0,              "count": 0,              "positive_count": 0,              "mean_predicted_probability": 0,              "observed_frequency": 0            },            {              "lower": 0,              "upper": 0,              "count": 0,              "positive_count": 0,              "mean_predicted_probability": 0,              "observed_frequency": 0            },            {              "lower": 0,              "upper": 0,              "count": 0,              "positive_count": 0,              "mean_predicted_probability": 0,              "observed_frequency": 0            },            {              "lower": 0,              "upper": 0,              "count": 0,              "positive_count": 0,              "mean_predicted_probability": 0,              "observed_frequency": 0            },            {              "lower": 0,              "upper": 0,              "count": 0,              "positive_count": 0,              "mean_predicted_probability": 0,              "observed_frequency": 0            },            {              "lower": 0,              "upper": 0,              "count": 0,              "positive_count": 0,              "mean_predicted_probability": 0,              "observed_frequency": 0            },            {              "lower": 0,              "upper": 0,              "count": 0,              "positive_count": 0,              "mean_predicted_probability": 0,              "observed_frequency": 0            }          ]        }      ]    },    "baselines": {      "property1": {        "floor": 0,        "class_order": [          "string"        ],        "probabilities": [          0        ],        "undefined_reason": "string",        "relative_error_reduction": 0,        "reduction_undefined_reason": "string",        "label": "string",        "higher_better": true,        "fit_on": "train",        "prediction": 0,        "constant_floor": 0,        "constant_label": "string"      },      "property2": {        "floor": 0,        "class_order": [          "string"        ],        "probabilities": [          0        ],        "undefined_reason": "string",        "relative_error_reduction": 0,        "reduction_undefined_reason": "string",        "label": "string",        "higher_better": true,        "fit_on": "train",        "prediction": 0,        "constant_floor": 0,        "constant_label": "string"      }    },    "evaluation": {      "metric_context": {        "undefined_reasons": {          "property1": "string",          "property2": "string"        },        "class_order": [          "string"        ],        "positive_class": "string",        "auc_average": "binary",        "average_precision_method": "non_interpolated",        "macro_f1_average": "unweighted_defined_classes",        "log_loss_epsilon": 0      },      "protocol_version": 0,      "interpretation": "descriptive_only",      "kind": "random_holdout",      "split": {        "seed": 0,        "shuffle": true,        "test_fraction_requested": 0,        "stratified": true,        "stratification_reason": "string",        "train_rows": [          0        ],        "test_rows": [          0        ]      },      "sampling": {        "method": "none",        "seed": 0,        "n_input": 0,        "n_missing_target": 0,        "n_eligible": 0,        "n_selected": 0,        "max_samples_requested": 0,        "effective_cap": 0      },      "class_counts": {        "eligible": [          {            "class": "string",            "count": 0          }        ],        "sampled": [          {            "class": "string",            "count": 0          }        ],        "train": [          {            "class": "string",            "count": 0          }        ],        "test": [          {            "class": "string",            "count": 0          }        ]      },      "auc": {        "variant": "string",        "class_order": [          "string"        ],        "positive_class": "string",        "available": true,        "unavailable_reason": "string"      }    },    "n_train": 1,    "n_test": 1,    "n_sampled_from": 1,    "warnings": [      "string"    ],    "feature_importance": [      {        "feature": "string",        "importance": 0      }    ]  }}

How is this guide?

Last updated on