Spavik
GuidesGet started

Quickstart

Evaluate a dataset, train a model and make a prediction with Python, JavaScript or REST.

1. Configure your API key

Create an API key from your workspace and keep it in an environment variable.

export SPAVIK_API_KEY="sk-spv-api-..."

Both SDKs default to https://api.spavik.co. SPAVIK_BASE_URL is optional for SDK calls: set it only to override that default.

Both SDKs send the key in X-Spavik-Api-Key. See Authentication. Choose your integration:

Install the Python SDK:

pip install spavik

Each code group below offers the same operation in Python, JavaScript and REST. Follow one tab throughout the walkthrough.

Download churn.csv and save it beside your script. These 300 synthetic customers demonstrate the call format, not production quality.

2. Evaluate the table

from spavik import Spavik

spavik = Spavik()
report = spavik.evaluate("churn.csv", target="churn")
print(report["assessment"])
print(report.get("validation"))

Evaluation is free and creates nothing. Inspect structural issues and the returned comparison before deciding whether to train. Read the evaluation guide: the random holdout does not validate every use case, and a better score on this sample does not guarantee future performance.

3. Train and predict

Once the data is prepared and the evaluation is suitable for your use case, train on the same data and schema. Training is free; the prediction below is billed for one row at the serving engine's credits per row, one on the default engine. See Costs and credits.

model = spavik.train("churn.csv", target="churn")
result = model.predict({"plan": "pro", "seats": 12, "tickets_90d": 3})
print(model.id, model.features)
print(result.predictions)

The API selects its configured default family when engine_family is omitted, through REST and both SDKs. Read GET /v1/engine-families to choose another family; the SDK option is engine_family in Python and engineFamily in JavaScript. Training requires at least ten labelled rows and target variation; those minimums do not establish quality.

4. Keep the prediction inputs and results

Store each input row and returned prediction alongside your business identifier, including its version, engine and optional request_id. When the observed outcome becomes available, report the input in features and the outcome in actual. Never invent an outcome just to exercise the update loop. See the feedback loop for examples in all three integrations.

For a time series

Forecasting keeps no model. Backtest the intended horizon first (free), inspect the assessment, then decide whether to pay for a forecast. Download sales.csv, six months of synthetic daily sales, to try it.

check = spavik.backtest("sales.csv", target="sales", timestamp="date", horizon=7)
print(check["assessment"])
# After reviewing the evaluation, this call costs 7 credits for one series:
forecast = spavik.forecast("sales.csv", target="sales", timestamp="date", horizon=7)
print(forecast.points)

Replace sales.csv with your own observed series. See Preparing your data for regular intervals, monthly dates and multiple series.

How is this guide?

Last updated on

On this page