Skip to content

Commit 2138f2e

Browse files
authored
Update README.md
1 parent 089167c commit 2138f2e

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

README.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Lookalike Model
22
## Introduction
3-
Facebook Lookalike Audience service requires three inputs: Source, Location and Audience Size. Source refers to source audience, which Facebook recommends using "1,000 to 50,000 of your best customers." Location restricts the lookalike audience to a specific geographic region. Audience Size specifies the desired size of lookalike audience to be generated, measured in millions or percentage of total population of selected location. It is the responsibility of Coupang to select the source audience, based on relevant metrics e.g. lifetime value, transaction value, total order size and engagement.
4-
53
Traditional segmentation approach applies hard filters to population, such as age range, account monetary value, and purchase frequency, to create segments. Because all filters must be satisfied, only the intersection of all filters remains. This methodology has two disadvantages.
64

7-
On one hand, hard filters may introduce human bias. For example, when promoting a baby product, requiring seed audience to be all females will leave out male customers who tend to their babies on their wives' behalf, or female customers who did not declare their gender on Coupang. If such bias is feed into Facebook Lookalike Audience, lookalike audience will all be females too.
8-
On the other hand, hard filters reduce the population so fast that only a few hundred customers remain after applying just a few filters. For example, among the 12.9 million active customers in 2018, there are only 140 customers who registered account on Aug 21, placed 3 (or more) items in cart within 7 days, but had not made a single purchase by Aug 29. Such small segment size is not enough to paint a meaningful persona to generate lookalike audience.
5+
1. On one hand, hard filters may introduce human bias. For example, when promoting a baby product, requiring seed audience to be all females will leave out male customers who tend to their babies on their wives' behalf, or female customers who did not declare their gender on Coupang. If such bias is feed into Facebook Lookalike Audience, lookalike audience will all be females too.
6+
7+
2. On the other hand, hard filters reduce the population so fast that only a few hundred customers remain after applying just a few filters. As the number of filters increases, the size of segment shrinks exponentially. When a segment becomes too small, it represents a too specialized set of customers who may not generalize to a meaningful persona to build lookalike audience.
98

109
<img src="fig/overview.jpg" width="700">
1110

@@ -14,31 +13,35 @@ The objective of this project is to build a lookalike model that "softens" the f
1413
Still, human bias is often helpful. Since the initial segments must be defined by the business team, in accordance with a specific business goal, such bias often aligns (albeit imperfectly) with the business goal. The role of the lookalike model is to take the initial segments as input, inspect its underlying structure, assign weights to features, build a larger segment using unsupervised machine learning, and output the enlarged segment to be used as source audience for Facebook Lookalike Audience service. For example, knowing that most diaper buyers are women is a meaningful piece of information, but the lookalike model will override the human bias that "diaper buyers must be female" if some male customers were found to conform to most of other features of the initial segments.
1514

1615
## Workflow
17-
Input source audience: an initial segment as a list of member_srls. The initial segment is defined by some hard filters chosen by the business team. Filters are selected for a specific business goal (e.g. promoting a particular product line). Notice: the lookalike model does NOT take filters as input.
16+
Input source audience: an initial segment as a list of member_srls. The initial segment is defined by some hard filters chosen by the business team. Filters are selected for a specific business goal (e.g. promoting a particular product line). Notice: the lookalike model does __NOT__ take filters as input.
1817

1918
1. Features extraction: for each customer in the initial input segment, a full list of features is retrieved.
2019
2. Feature weighting: for each feature, Jensen-Shannon divergence is computed and assigned as weight.
2120
3. Subset selection: the top 20 features with highest weight are used for the next step.
22-
4. Near Neighbor Ranking: compute average of the initial segment as centroid, rank its nearest neighbor by a distance metric 5. (Euclidean, cosine, Mahalanobis, etc.).
23-
Output lookalike audience: a set of lookalike audience larger than the initial input. The sized of lookalike audience can be arbitrarily set to n. The top n customers most similar to the initial segment are returned.
21+
4. Near Neighbor Ranking: compute average of the initial segment as centroid, rank its nearest neighbor by a distance metric (Euclidean, cosine, Mahalanobis, etc.).
22+
5. Output lookalike audience: a set of lookalike audience larger than the initial input. The sized of lookalike audience can be arbitrarily set to n. The top n customers most similar to the initial segment are returned.
2423

25-
<img src="fig/workflow.jpg" width="450">
24+
<p align="center">
25+
<img src="fig/workflow.jpg" width="450">
26+
</p>
2627

2728
## Feature Extraction
2829

2930
The full model includes 1805 features, which are computed primarily based on bimart.cs_sales and indexing_platform.user_behavior_log. Because the indexing_platform.user_behavior_log table is huge, it is impossible to compute 1805 features for the entire population of approximately 11 million customer (after 12 hours, the task is killed). Instead, the sql must be run on private cluster using Zeppelin Sandbox.
3031

3132
The partial model includes 957 features, which are computed based on bimart.cs_sales in Redshift. The 957 features (9 * 106 + 3) are highlighted by red colors in the table above. It takes about 30 minutes to finish the entire feature extraction process on Redshift.
3233

33-
The redshift SQL commands are syntactically different from Hive SQL commands, both versions are (hopefully) bug-free. Refer to README.txt in the sql_hive and sql_redshift directories for detailed explanations on how to use the files.
34+
The redshift SQL commands are syntactically different from Hive SQL commands, both versions are (hopefully) bug-free. Refer to README.txt in the [sql_hive](sql_hive/README.txt) and [sql_redshift](sql_redshift/README.txt) directories for detailed explanations on how to use the files.
3435

3536
* Need: annualized aggregate spending (aas), annualized order count (cto), annualized quantity count (ctq), days per order (dpo), day per quantity (dpq) quantify customer's need for each product category.
3637
* Habit: annualized view count (ctv) measures indirectly how much interests a customer places in each product category.
3738
* Engagement: view per order (vpo), view per quantity (vpq) measure how much attention a customer spends on looking for the best offer in each product category.
3839
* Spending power: GMV per order (gpo), per quantity (gpq), per day (gpd) measure how much a customer is willing to spend (per unit order / quantity) in each product category.
3940
* Churn: days since last order (dal), views since last order (vsl) measure how likely a user is going to place the next order in each product category.
4041

41-
<img src="fig/sql.jpg" width="800">
42+
<p align="center">
43+
<img src="fig/sql.jpg" width="800">
44+
</p>
4245

4346
### Naming Convention
4447
Each feature is referred to as symbol + category code, in which category code is padded with 0 to the front to maintain a consistent 3-digit code. For example, "cto078" refers to annualized order count in category 78 (Overseas Travel - Ticket/Pass). Use the script here to generate names for all features. An exhaustive list of 1805 feature names can be found [here](data/feature_code.csv) as a csv file.
@@ -48,7 +51,9 @@ The model uses Jensen-Shannon divergence (JS divergence) to measure the importan
4851

4952
The model computes JS divergence for every feature of the source audience, compared against the population sample. The features with highest JS divergence are selected. In the python class, parameter max_features specifies the number of top features with highest JS divergence; parameter threshold specifies the minimum JS divergence required to be considered as meaningful divergence. If none of the features exceeds minimum threshold, no feature is selected. If more than max_features number of features exceed the minimum threshold, the top max_features features are selected. The final feature weights are computed by normalizing JS divergence of valid candidate features.
5053

51-
<img src="fig/js_div.jpg" width="600">
54+
<p align="center">
55+
<img src="fig/js_div.jpg" width="600">
56+
</p>
5257

5358
Warning: you must have at least 1 feature with meaningful divergence for the lookalike model to proceed. Empirically, a good range of features is 5 ~ 15. The default max_features is set to 20, beyond which joining table (10 million rows, one per customer) successively takes exponentially more time. The default threshold is set to 0.05, below which divergence is more likely caused by noise, not by source audience characteristic.
5459

@@ -60,7 +65,7 @@ The full feature table does not have to bee updated frequently, as the features
6065

6166
## How to use
6267
### Step 1
63-
Connect to pang-SFO.
68+
Connect to pang-SFO. You cannot use Coupang's guest wifi, or home wifi. Connect VPN if necessary.
6469

6570
### Step 2
6671
If using Redshift, run SQL commands sequentially in sql_redshift foldler. For detailed instruction, refer to this [guide](sql_redshift/README.txt).
@@ -142,7 +147,9 @@ Generally, when the population distribution is normal, lookalike audience's shif
142147

143148
Note that the shape of histogram depends on the lookalike audience size. The more lookalike audience, the more its shape converges to the population (if the lookalike audience is chosen to be the same size of the population, then the two become exactly identical).
144149

145-
![Result](output/mom_src_srls/lookalike.png)
150+
<p align="center">
151+
<img src="output/mom_src_srls/lookalike.png" width="800">
152+
</p>
146153

147154
## Caution
148155
The model is most useful when the goal is to understand the source audience's concern on specific product category or range of product categories. Simply select source audience based on account value, gender, platform, or registration time will should not produce any meaningful insights from the source audience.

0 commit comments

Comments
 (0)