Skip to main content
Documentation

Deployments

A deployment exposes one target of a finished analysis as an authenticated REST endpoint. Deploying does not recompute or copy anything: the endpoint reads the model your analysis already discovered and evaluates it in-process, so predictions are fast and always come from exactly the model you reviewed.

Creating a deployment

Open the notebook of a finished analysis and use the Deploy as REST endpoint action in the notebook header. Pick the target you want to serve and, optionally, a name. The dialog then shows the endpoint URL, the feature keys the model expects, the prediction interval derived from held-out data, and a copyable example call. All your deployments are listed on the Deployments page, where you can inspect each one, try it interactively, and delete it again.

The predict endpoint

Send a POST request with one row of feature values. Authenticate with a dfat_ API token minted in Project settings → API Tokens (a signed-in session token works too). See API Authentication.
curl
curl -X POST 'https://diafunc.com/api/v1/deployments/<deploymentId>/predict' \
  -H 'Authorization: Bearer dfat_…' \
  -H 'Content-Type: application/json' \
  -d '{
  "features": {
    "alcohol": 11.2,
    "sugar": 2.5
  }
}'
Python
JavaScript
The response contains the predicted value, a 95% prediction interval, and a predictionId you can use later to report the realised outcome:
Response
{
  "target": "quality",
  "prediction": 6.4,
  "confidence": {
    "lower": 5.8,
    "upper": 7.0,
    "halfWidth": 0.6,
    "level": 0.95,
    "method": "empirical_p5_p95",
    "nHeldOut": 800
  },
  "predictionId": "5f1f6c2e-…"
}
The interval is computed from the residuals of held-out rows during the analysis (method: "empirical_p5_p95"). When those residual statistics are not available, confidence is null. Numeric-looking strings in features are coerced to numbers; other strings are passed through unchanged.

Closing the loop: record outcomes

Every prediction is logged. Once the real value is known, report it back with the predictionId from the predict response:
Record an outcome
curl -X POST 'https://diafunc.com/api/v1/deployments/<deploymentId>/predictions/<predictionId>/outcome' \
  -H 'Authorization: Bearer dfat_…' \
  -H 'Content-Type: application/json' \
  -d '{ "actual": 6.0 }'
Recorded outcomes feed the per-deployment performance report (mean absolute error, R², and the recent predictions with their actuals), shown in the expanded row on the Deployments page and available as GET /api/v1/deployments/<deploymentId>/performance. MAE and R² appear once at least two outcomes have been recorded. You can also record outcomes directly in the performance table of the Deployments page.

Scope and behavior

A deployment serves exactly one target of one analysis and is private to your account. Deleting a deployment removes the endpoint; the analysis and its model are untouched. The prediction is always a single numeric value per call, with one feature row per request.

What next?