Cortex extends the value of your business’s unique data by enabling anyone to leverage that data into Machine Learning Pipelines. The types of data supported by Cortex fall into two categories: events and attributes.
|Events (required)||Attributes (optional)|
|Actions taken by or on one or more objects at a particular point in time. Example: Customer A completes a purchase event on item B at time C.||Characteristics or traits associated with the objects tied to your events. Examples: Customer A has job title X, Item B belongs to category Y.|
In this guide, we’ll provide an overview of Attribute Data and discuss the various ways that it may be ingested into Cortex. For an overview of Events Data, click here.
What are attributes?
Attributes provide additional information about the objects tied to your events. Attribute data is optional in Cortex, but recommended – the more data at Cortex’s disposal, the wider the set of predictions you can make, and the more accurate your predictions will be.
Attribute data can include any descriptors the objects in your event data. For example, if you’re tracking customer purchase behavior via an events stream, you may choose to supplement that data with user attributes from a Customer Data Platform (e.g. age, gender, geo, loyalty status) and/or item attributes from a Content Management System (e.g. category, price, brand).
How do I send attribute data into Cortex?
There are two ways that you can ingest attribute data into Cortex:
1) Within Events
The simplest way to import attributes into Cortex is to include them as fields within your events. This is especially recommended for attributes that change relatively frequently (e.g. item price), so that Cortex has direct access to the value of the attribute at the time of each event.
For example, the below purchase event includes not only required information about the event itself, but also attributes of (a) the user making the purchase, and (b) the item that was purchased.
user_id: ABC # REQUIRED: Unique ID for the user completing the event type: purchase # REQUIRED: Type of event completed by the user timestamp: 1590451200 # REQUIRED: Timestamp of when the event occurred device: mobile # The device on which the event occurred coupon_discount: 4.99 # The dollar amount of discounts applied to the purchase sale_price: 45.00 # The final sale price that the user paid item_id: XYZ # Unique ID for the purchased item
2) Separate Attribute Feeds
Alternatively, you may upload recurring files (CSV, JSON, or Parquet) containing up-to-date records of each object’s attributes. This file must include the same unique object identifier (e.g. user_id or item_id) contained within your event data so that Cortex can tie the two data sources together.
The below table shows an example of what an item attribute feed might look like in CSV form. Note that in order to generate personalized item recommendations for each of your users, you must send an item attribute feed into Cortex and include the item ID referenced within your user behavioral events.
When you upload a file like this, Cortex stores the attributes with a timestamp indicating when each was ingested. This allows your pipelines to access a historical record of attribute values over time. For example, by recording that Item ABC cost $10 on January 1st but changed to $15 on January 8th, your pipeline will know the exact price at the time of each purchase event.
Still have questions? Reach out to email@example.com for more info!