cohorts

Embed
Preview of the card
<a href="https://lucidace.com/docs/ref-cohorts"><img src="https://lucidace.com/docs/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/da916cd3-c0fc-4b63-b971-b3c13623daf3/pages/2a9cbdad-e9aa-41c0-b49c-520116ed35db/social-card.svg?v=3e7ae33eec8b" alt="cohorts" width="600" height="315"></a>
GEThttps://lucidace.com/v1/projects/{project_id}/predictive-cohortsScope cohort:read

Parameters

project_idstringpathrequired
limitintegerquery
cursorstringquery

Code samples

cURL
curl -X GET "https://lucidace.com/v1/projects/{project_id}/predictive-cohorts"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "data": [
    {
      "cohort_id": "string",
      "created_at": "2024-01-01T00:00:00Z",
      "created_by": "string",
      "features": [
        "string"
      ],
      "goal": "string",
      "horizon_days": 0,
      "id": "string",
      "last_error": "string",
      "lookback_days": 0,
      "metrics": {},
      "model": {},
      "model_kind": "string",
      "name": "string",
      "property_features": [
        {}
      ],
      "retrain_every_hours": 0,
      "retrain_from": "string",
      "scored_count": 0,
      "seed": 0,
      "selection": {},
      "target": "string",
      "trained_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z",
      "value_property": "string"
    }
  ],
  "next_cursor": "string"
}
Schema
dataobject[]required
Show child parameters
cohort_idstringrequired
The static cohort that holds the scored members.
created_atstringrequired
created_bystring
featuresstring[]required
Event names counted as features.
goalstringrequired
Goal event name.
horizon_daysintegerrequired
idstringrequired
last_errorstring
Why the last scheduled training failed.
lookback_daysintegerrequired
metricsobject
Holdout auc, calibration, row counts and base rate of the last training.
modelobject
{bias, features: [{name, weight, mean, scale}]}: weights are on standardised ln(1 + count).
model_kindstringrequired
linear, or interactions (adds the pairwise products of the features).
namestringrequired
property_featuresobject[]required
[{event, key, value}]: counts of an event where a property has a value, after features.
retrain_every_hoursinteger
Retrain this often; null = only on request.
retrain_fromstringrequired
The schedule counts from the last attempt or the last success.
scored_countinteger
seedintegerrequired
selectionobjectrequired
{"top_k": n} or {"threshold": p}.
targetstringrequired
conversion (probability of the goal) or revenue (predicted goal amount, P-M39).
trained_atstring
updated_atstringrequired
value_propertystring
Numeric goal property summed as the amount when target is revenue.
next_cursorstring
404
POSThttps://lucidace.com/v1/projects/{project_id}/predictive-cohortsScope cohort:write

Parameters

project_idstringpathrequired

Request body

application/json
featuresstring[]required
Event names whose recent counts are the model inputs (1 to 20).
goalstringrequired
The event to predict.
horizon_daysinteger
Predict the goal within this many days (1 to 90, default 7).
lookback_daysinteger
Days of history behind each person's counts (1 to 180, default 30).
model_kindstring
linear (default) or interactions: also learns from each pair of features together.
namestringrequired
property_featuresarray
[{event, key, value}]: count event only where property key equals value (at most 20 features with features).
retrain_every_hoursinteger
Retrain this often (1 to 8760 hours); omit for manual retraining only.
retrain_fromstring
The schedule counts from the last attempt (default) or the last success.
seedinteger
Seeds the training sample and holdout split (default 0).
selectionobjectrequired
{"top_k": n} (1 to 10000) or {"threshold": p} (0 to 1, exclusive).
targetstring
conversion (default: probability of the goal) or revenue (predicted goal amount over the horizon, an LTV model; needs value_property). With revenue, a threshold is an amount.
value_propertystring
Numeric goal-event property holding the amount (for example revenue), for target: revenue.
{
  "features": [
    "string"
  ],
  "goal": "string",
  "horizon_days": 0,
  "lookback_days": 0,
  "model_kind": "string",
  "name": "string",
  "property_features": [
    {}
  ],
  "retrain_every_hours": 0,
  "retrain_from": "string",
  "seed": 0,
  "selection": {},
  "target": "string",
  "value_property": "string"
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/predictive-cohorts" \
  -H "Content-Type: application/json" \
  -d '{"features":["string"],"goal":"string","horizon_days":0,"lookback_days":0,"model_kind":"string","name":"string","property_features":[{}],"retrain_every_hours":0,"retrain_from":"string","seed":0,"selection":{},"target":"string","value_property":"string"}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

201 Trained and scored; metrics hold the holdout AUC and calibration
Example
{
  "cohort_id": "string",
  "created_at": "2024-01-01T00:00:00Z",
  "created_by": "string",
  "features": [
    "string"
  ],
  "goal": "string",
  "horizon_days": 0,
  "id": "string",
  "last_error": "string",
  "lookback_days": 0,
  "metrics": {},
  "model": {},
  "model_kind": "string",
  "name": "string",
  "property_features": [
    {}
  ],
  "retrain_every_hours": 0,
  "retrain_from": "string",
  "scored_count": 0,
  "seed": 0,
  "selection": {},
  "target": "string",
  "trained_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z",
  "value_property": "string"
}
Schema
cohort_idstringrequired
The static cohort that holds the scored members.
created_atstringrequired
created_bystring
featuresstring[]required
Event names counted as features.
goalstringrequired
Goal event name.
horizon_daysintegerrequired
idstringrequired
last_errorstring
Why the last scheduled training failed.
lookback_daysintegerrequired
metricsobject
Holdout auc, calibration, row counts and base rate of the last training.
modelobject
{bias, features: [{name, weight, mean, scale}]}: weights are on standardised ln(1 + count).
model_kindstringrequired
linear, or interactions (adds the pairwise products of the features).
namestringrequired
property_featuresobject[]required
[{event, key, value}]: counts of an event where a property has a value, after features.
retrain_every_hoursinteger
Retrain this often; null = only on request.
retrain_fromstringrequired
The schedule counts from the last attempt or the last success.
scored_countinteger
seedintegerrequired
selectionobjectrequired
{"top_k": n} or {"threshold": p}.
targetstringrequired
conversion (probability of the goal) or revenue (predicted goal amount, P-M39).
trained_atstring
updated_atstringrequired
value_propertystring
Numeric goal property summed as the amount when target is revenue.
400
403
404
422 Not enough people who reached the goal to train
503
GEThttps://lucidace.com/v1/projects/{project_id}/predictive-cohorts/{id}Scope cohort:read

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X GET "https://lucidace.com/v1/projects/{project_id}/predictive-cohorts/{id}"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 model.features lists each input's weight: positive raises the score

Same as 201 · POST /v1/projects/{project_id}/predictive-cohorts

404
PUThttps://lucidace.com/v1/projects/{project_id}/predictive-cohorts/{id}Scope cohort:write

Parameters

project_idstringpathrequired
idstringpathrequired

Request body

application/json
model_kindstring
Omit to keep; used from the next training.
namestringrequired
retrain_every_hoursinteger
retrain_fromstring
Omit to keep.
selectionobjectrequired
{
  "model_kind": "string",
  "name": "string",
  "retrain_every_hours": 0,
  "retrain_from": "string",
  "selection": {}
}

Code samples

cURL
curl -X PUT "https://lucidace.com/v1/projects/{project_id}/predictive-cohorts/{id}" \
  -H "Content-Type: application/json" \
  -d '{"model_kind":"string","name":"string","retrain_every_hours":0,"retrain_from":"string","selection":{}}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 Applies at the next training

Same as 201 · POST /v1/projects/{project_id}/predictive-cohorts

400
403
404
DELETEhttps://lucidace.com/v1/projects/{project_id}/predictive-cohorts/{id}Scope cohort:write

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X DELETE "https://lucidace.com/v1/projects/{project_id}/predictive-cohorts/{id}"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

204 Stops retraining; the static cohort stays until deleted
403
404
POSThttps://lucidace.com/v1/projects/{project_id}/predictive-cohorts/{id}/retrainScope cohort:write

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/predictive-cohorts/{id}/retrain"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

403
404
422
503
Updated