Churn scoring quickstart

Interface

In this quickstart, we'll show you how to:

  • Add data representing your transaction events using a dataset.
  • Add data representing your cancellation events using a dataset.
  • Describe your Customers group formally using a cohort.
  • Describe your Churned customers group formally using a cohort.
  • Create a predictive model for likelihood to churn using an outcome.
  • Deploy your churn scoring predictions using a pipeline

Let's dive in.

Transaction event stream

Add data

Create a transaction event stream

Using CSV as an easy example

This section describes how to add data securely using a CSV file that you export from your data infrastructure.

Most Faraday users eventually update their configuration to pull data directly from their data warehouses, cloud buckets, or databases. To do that, you’ll add your source as a Connection and then choose it below instead of CSV.

For more, see our docs on Datasets and Connections.

  1. Extract a CSV representing your transaction from your systems, or download the sample transactions file from Farazona. Either way, save it someplace memorable.
curl

First, upload your data with a POST /uploads request:

curl --request POST \ --url https://api.faraday.ai/v1/uploads/transactions/YOUR_CSV_FILE.csv \ --header 'Accept: application/json' \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'Content-Type: application/octet-stream' \ --data-binary "@YOUR_CSV_FILE.csv"

Then use a POST /datasets request to register the data:

curl https://api.faraday.ai/datasets --json '{
  "name": "Transaction",
  "identity_sets": {
    "shipping": {
      "city": "shipping_city",
      "house_number_and_street": [
        "shipping_address1",
        "shipping_address2"
      ],
      "person_first_name": "shipping_address_fn",
      "person_last_name": "shipping_address_ln",
      "postcode": "shipping_postcode",
      "state": "shipping_state"
    }
  },
  "options": {
    "type": "hosted_csv",
    "upload_directory": "transaction_data_files"
  },
  "output_to_streams": {
    "transaction": {
      "data_map": {
        "datetime": "created_at"
      },
      "value": "total"
    }
  }
}'

Your event stream will start building in the background. You can proceed immediately with the next set of instructions. When your stream is done building, you’ll get an email.

Cancellation event stream

Add data

Create a cancellation event stream

Using CSV as an easy example

This section describes how to add data securely using a CSV file that you export from your data infrastructure.

Most Faraday users eventually update their configuration to pull data directly from their data warehouses, cloud buckets, or databases. To do that, you’ll add your source as a Connection and then choose it below instead of CSV.

For more, see our docs on Datasets and Connections.

  1. Extract a CSV representing your cancellation from your systems, or download the sample transactions file from Farazona. Either way, save it someplace memorable.
curl

First, upload your data with a POST /uploads request:

curl --request POST \ --url https://api.faraday.ai/v1/uploads/cancellations/YOUR_CSV_FILE.csv \ --header 'Accept: application/json' \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'Content-Type: application/octet-stream' \ --data-binary "@YOUR_CSV_FILE.csv"

Then use a POST /datasets request to register the data:

curl https://api.faraday.ai/datasets --json '{
  "name": "Cancellation",
  "identity_sets": {
    "shipping": {
      "city": "shipping_city",
      "house_number_and_street": [
        "shipping_address1",
        "shipping_address2"
      ],
      "person_first_name": "shipping_address_fn",
      "person_last_name": "shipping_address_ln",
      "postcode": "shipping_postcode",
      "state": "shipping_state"
    }
  },
  "options": {
    "type": "hosted_csv",
    "upload_directory": "cancellation_data_files"
  },
  "output_to_streams": {
    "cancellation": {
      "data_map": {
        "datetime": "created_at"
      },
      "value": "total"
    }
  }
}'

Your event stream will start building in the background. You can proceed immediately with the next set of instructions. When your stream is done building, you’ll get an email.

Customers cohort

  1. You'll need a Faraday account — signup is free!

Confirm your data

Event streams

Unless you’ve already created it for another quickstart or purpose, you’ll need to add the following event stream to your account:

  • Transaction

What’s an event stream?

Predicting a certain customer behavior requires historical examples of customers exhibiting that behavior. Faraday works best when that data comes in the form of “events” — specific actions or occurrences that happened at specific times.

Formulating data this way helps you define cohorts more expressively.

For example, a Customers cohort could be defined as the group of people who have all experienced a Transaction event at least once.

For more, see our docs on Cohorts, Events, Traits, and Datasets (which define how events and traits emerge from your data).

curl

To verify, use a GET /streams request. Your response should look like this:

[{
  "name": "Transaction",
  "id": "$TRANSACTION_STREAM_ID"
, ...}]

Make note of the IDs of the necessary streams.

If the required stream isn’t there, follow the instructions using this button, then return here to resume.

Create cohort

Create a customers cohort

curl

Use a POST /cohorts request:

curl https://api.faraday.ai/cohorts --json '{
  "name": "Customers",
  "stream_name": "transaction"
}'

Your cohort will start building in the background. You can proceed immediately with the next set of instructions. When your cohort is done building, you’ll get an email.

Churned customers cohort

  1. You'll need a Faraday account — signup is free!

Confirm your data

Event streams

Unless you’ve already created it for another quickstart or purpose, you’ll need to add the following event stream to your account:

  • Cancellation

What’s an event stream?

Predicting a certain customer behavior requires historical examples of customers exhibiting that behavior. Faraday works best when that data comes in the form of “events” — specific actions or occurrences that happened at specific times.

Formulating data this way helps you define cohorts more expressively.

For example, a Customers cohort could be defined as the group of people who have all experienced a Transaction event at least once.

For more, see our docs on Cohorts, Events, Traits, and Datasets (which define how events and traits emerge from your data).

curl

To verify, use a GET /streams request. Your response should look like this:

[{
  "name": "Cancellation",
  "id": "$CANCELLATION_STREAM_ID"
, ...}]

Make note of the IDs of the necessary streams.

If the required stream isn’t there, follow the instructions using this button, then return here to resume.

Create cohort

Create a churned customers cohort

curl

Use a POST /cohorts request:

curl https://api.faraday.ai/cohorts --json '{
  "name": "Churned customers",
  "stream_name": "cancellation"
}'

Your cohort will start building in the background. You can proceed immediately with the next set of instructions. When your cohort is done building, you’ll get an email.

Likelihood to churn outcome

  1. You'll need a Faraday account — signup is free!

Confirm your data

Cohorts

Unless you’ve already created them for another quickstart or purpose, you’ll need to add the following cohorts to your account:

  • Churned customers
  • Customers

What’s a cohort?

A cohort is Faraday’s term for a commercially significant group of people — for example, a brand’s customers, leads, or even “people who bought X and Y and then cancelled.”

Cohort membership is fluid — continuously computed by Faraday — and is defined by events its members must all have experienced and/or traits its members must all share.

For example, a Customers cohort could be defined as the group of people who have all experienced a Transaction event at least once.

For more, see our docs on Cohorts, Events, Traits, and Datasets (which define how events and traits emerge from your data).

curl

To verify, use a GET /cohorts request. Your response should look like this:

[{
  "name": "Churned customers",
  "id": "$CHURNED_CUSTOMERS_COHORT_ID"
, ...}{
  "name": "Customers",
  "id": "$CUSTOMERS_COHORT_ID"
, ...}]

Make note of the IDs of the necessary cohorts.

If the required cohorts aren’t there, follow the instructions using these buttons, then return here to resume.

Configure your prediction

Create a likelihood to churn outcome

curl

Use a POST /outcomes request:

curl https://api.faraday.ai/outcomes --json '{
  "name": "Likelihood to churn",
  "attainment": "$CHURNED_CUSTOMERS_COHORT_ID",
  "eligible": "$CUSTOMERS_COHORT_ID"
}'

Your outcome will start building in the background. You can proceed immediately with the next set of instructions. When your outcome is done building, you’ll get an email.

Churn scoring deployment

  1. You'll need a Faraday account — signup is free!

Confirm your data

Unless you’ve already created them for another quickstart or purpose, you’ll need to add the following cohorts to your account:

  • Customers
  • Churned customers

Cohorts

What’s a cohort?

A cohort is Faraday’s term for a commercially significant group of people — for example, a brand’s customers, leads, or even “people who bought X and Y and then cancelled.”

Cohort membership is fluid — continuously computed by Faraday — and is defined by events its members must all have experienced and/or traits its members must all share.

For example, a Customers cohort could be defined as the group of people who have all experienced a Transaction event at least once.

For more, see our docs on Cohorts, Events, Traits, and Datasets (which define how events and traits emerge from your data).

curl

To verify, use a GET /cohorts request. Your response should look like this:

[{
  "name": "Customers",
  "id": "$CUSTOMERS_COHORT_ID"
, ...}{
  "name": "Churned customers",
  "id": "$CHURNED_CUSTOMERS_COHORT_ID"
, ...}]

Make note of the IDs of the necessary cohorts.

If the required cohorts aren’t there, follow the instructions using these buttons, then return here to resume.

Confirm your predictions

Unless you’ve already created it for another quickstart or purpose, you’ll need to add the following prediction in your account:

  • Outcome: Likelihood to churn
Outcomes

What’s an outcome?

An outcome is what you use in Faraday to define a propensity objective, such as likelihood to convert, buy again, or churn.

For more, see our docs on Outcomes.

curl

To verify, use a GET /outcomes request. Your response should look like this:

[{
  "name": "Likelihood to churn",
  "id": "$LIKELIHOOD_TO_CHURN_OUTCOME_ID"
, ...}]

If the required outcome isn’t there, follow the instructions using this button, then return here to resume.

Deploy your predictions

Now you’ll create the pipeline necessary to deploy your predictions.

Create a pipeline for churn scoring

curl

Use a POST /scopes request:

curl https://api.faraday.ai/scopes --json '{
  "name": "Churn scoring",
  "population": {
    "include": [
      "$CUSTOMERS_COHORT_ID"
    ]
  },
  "payload": {
    "outcome_ids": [
      "$LIKELIHOOD_TO_CHURN_OUTCOME_ID"
    ]
  }
}'

Your pipeline will start building in the background. You can proceed immediately with the next set of instructions. When your pipeline is done building, you’ll get an email.

Deploy your churn scoring pipeline

Deploying to CSV as an easy example

This section describes how to deploy your predictions to a CSV file that Faraday securely hosts (and continuously updates) for you to retrieve either manually or on a scheduled basis using your existing data infrastructure.

Most Faraday users eventually update their pipelines to deploy to data warehouses, cloud buckets, or databases. To do that, you’ll add your destination as a Connection and then choose it instead of Hosted CSV.

For more, see our docs on Pipelines and Connections

curl

Use a POST /targets request:

curl https://api.faraday.ai/targets --json '{
  "name": "Churn scoring in CSV",
  "scope_id": "$CHURN_SCORING_SCOPE_ID",
  "representation": {
    "mode": "identified"
  },
  "options": {
    "type": "hosted_csv"
  }
}'

Your pipeline will finish building in the background. You can proceed immediately with the next set of instructions. When it’s done, you’ll get an email—then you can return to this pipeline and click the Enable pipeline button to activate it.