rank

A rank question puts cases in order of their chance of the outcome, highest first, and returns the top top_k. Jev has no counterpart: a Jev question judges one input at a time. rank orders a whole record in one call.

When to use

Use rank when the question is "who first?": which accounts to call, which deals to rescue, which machines to inspect, which runs to review. For the chance of particular cases, use yesno.

Request

Rank the whole record: leave cases out.

{
  "data": {"dataset_id": "sample:saas_churn"},
  "entity_column": "customer_id", "subject_kind": "org",
  "questions": {"queue": {"type": "rank", "outcome_column": "churned", "outcome_is_desirable": false, "top_k": 3}}
}
Field
type "rank"
outcome_column the yes/no column to learn
top_k how many to return, 1 to 1,000. Default 20.

With cases, rank orders only those cases. The call's other question types always need cases, so to rank the whole record, ask rank in its own call. The fit is shared across calls, so the second call costs no second fit.

Answer

"queue": {
  "type": "rank", "state": "answered",
  "ranked_total": 800,
  "ranked": [
    {"position": 1, "entity_id": "cust_0563", "p": 0.776, "reasons": ["…"]},
    {"position": 2, "entity_id": "cust_0088", "p": 0.774, "reasons": ["…"]},
    {"position": 3, "entity_id": "cust_0050", "p": 0.752, "reasons": ["…"]}
  ]
}

ranked_total is how many cases were ranked. ranked holds the top top_k, each with its position, p and reasons. Equal chances are ordered by entity id, so the order is always the same. Only the returned cases are billed and signed.

Writing rank questions

  • Rank toward what you'll act on. For a churn queue, rank by churned. For a win-back list, rank by the chance of coming back, if the record has it.
  • Take top_k from your capacity. If the team can make 50 calls a week, ask for 50.
  • Rank new cases with cases.rows. For example, this morning's open tickets, ranked against the history of past ones.