Deploying predictions
The last step is deploying your predictions so you can use them to improve your business.
Prediction deployment
Just as Faraday will automatically build and validate models based on the objectives you declare, we also continuously pre-compute and deploy all the predictions you may need.
- Scopes — Use a scope to tell Faraday which predictions you may want on which people
- Targets — Add targets to indicate where your predictions should get deployed
Scopes
In order to understand what predictions you may need, Faraday allows you to declare one or more Scopes. These scopes provide a pre-computation boundary so that Faraday's deployment system can continuously deliver what you need.
Prediction scopes
A scope consists of two things:
- Population — who will you want to retrieve predictions about?
- Payload — what predictions about them will you want to retrieve?
Defining
You'll use POST /scopes
to define your scopes. Here's the main part of the query:
curl --request POST \
--url https://api.faraday.io/v1/scopes \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '
{
...
}
'
You will need to specify the two parameters above (population and payload) in the JSON POST data as follows.
Population
When creating a scope, you list one or more cohorts that together serve as the scope's population. If you use multiple cohorts, they are unioned (OR) to produce a single population with no duplicates.
{
"population": {
"cohort_ids": [
"A_COHORT_ID",
"ANOTHER_COHORT_ID",
...
]
},
...
}
'
Payload
You will also choose one or more elements to comprise your scope's payload. These can include:
- Outcomes — propensity objectives
- Persona Sets — persona objectives
- Attributes (private beta) — Include raw data in your scope
- Cohorts (private beta) — Include cohort membership flags in your scope
{
...
"payload": {
"outcome_ids": [
"YOUR_OUTCOME_ID"
],
"persona_set_ids": [
"YOUR_PERSONA_SET_ID"
]
}
}
'
Complete scope example
curl --request POST \
--url https://api.faraday.io/v1/scopes \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '
{
"payload": {
"persona_set_ids": [
"YOUR_PERSONA_SET_ID"
]
},
"population": {
"cohort_ids": [
"YOUR_COHORT_ID"
]
},
"name": "SCOPE_NAME",
"preview": false
}
'
Targets
Now that you've declared the predictions you want to deploy with a scope, you'll add one or more Targets to indicate where they should be deployed.
Scope targets
Faraday continuously renders each scope in the system to produce a spreadsheet-like table where each payload element gets a column and each member of the population gets a row. When you add a target, you're telling Faraday to copy the "spreadsheet" to a place where you can retrieve the predictions you need to support your business.
Target representations
A target represents its underlying pipeline and can do so in several ways, controlled by the representation
parameter on the POST /targets
call.
Hashed
Example use case: deploying audiences to ad platforms.
Hashes all identity data (e.g. email, address) in the output. This option may produce multiple rows per person — one for each hashed identity Faraday associates with that person — including people the account has not previously identified in a dataset.
🚧️
Precise outcome (propensity) score columns will be excluded from the hashed target output to protect privacy.
Referenced
Example use case: deploying to a CDP, CRM, database, or email platform to enhance known contacts with predictions.
This option will produce one row per person, limited to people already identified in a dataset of your choice. To protect privacy, this will not include identifying information other than the reference key (e.g. customer ID or email address) you select, which must be done at the dataset level first.
Identified
Example use case: direct mail or canvassing campaign.
This option will produce one row per person or household and, depending on your plan, may include people not previously identified in a dataset in your account.
🚧️
The number of people unknown to your account (i.e., not included in any dataset) included in the output, if any, is governed by your plan and will be limited to a fixed cap.
Aggregated
Example use case: geotargeted ad campaigns
This option will produce one row per geographical area (e.g. state or zipcode) with aggregated payload elements.
🚧️
To avoid confusion, traits in your payload will not be included in aggregated targets.
Available targets
Faraday natively supports many deployment targets. They organize into two categories:
- Publication targets — Faraday hosts your predictions for convenient retrieval as needed.
- Replication targets — Faraday copies your predictions to systems you control.
Publication targets
Often the easiest to start with, publication targets are securely hosted by Faraday, so they don't require you to establish connections to your systems up front.
Currently supported:
- CSV — Faraday hosts a CSV for you to retrieve by your choice of protocol: HTTPS, S3, GCS, or SFTP.
- API — Faraday hosts your predictions in a high-speed JSON key-value store for you to retrieve individually in real time using an HTTP API.
Coming soon:
- SQL — Faraday hosts your predictions in a SQL-compatible database table for you to query as needed.
Replication targets
Faraday can also copy your predictions to a system you control. You'll first need to establish a Connection to that system, then you can add the corresponding target to your scope.
Under the hood, Faraday uses its open-source dbcrossbar tool to replicate your data from the Faraday platform to your systems. Currently, dbcrossbar supports the following:
System | Format |
---|---|
Redshift | Table |
BigQuery | Table |
PostgreSQL | Table |
AWS S3 | CSV file |
Google Cloud Storage (GCS) | CSV file |
Adding a target
You'll use POST /targets
queries to add targets. Here's a sample request:
curl --request POST \
--url https://api.faraday.ai/v1/targets \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '
{
"name": "TARGET_NAME",
"options": {
"type": "hosted_csv"
},
"representation": {
"mode": "hashed"
},
"scope_id": "YOUR_SCOPE_ID"
}
'
Adding publication targets only requires a type
parameter; replication targets require an existing Connection and additional parameters. See the docs on individual targets for more information.
👍You're done!
That's all there is to making and deploying predictions with Faraday. If you haven't already, check out one of the quickstart tutorials listed below. Also, feel free to join our Discord anytime to share ideas and get help.