In this example, JoinColumns = 'product'. The function tries to identify segments of customers that often purchase the same products.
Input
- InputTable: sales_transaction, as in CFilter Example 1: Collaborative Filtering by Product
SQL Call
SELECT * FROM CFilter ( ON sales_transaction AS InputTable OUT TABLE OutputTable (cfilter_output1) USING TargetColumns ('customer_segment') JoinColumns ('product') ) AS dt;
Output
This query returns the following table:
SELECT * FROM cfilter_output1 ORDER BY col1_item1, score;
col1_item1 | col1_item2 | cntb | cnt1 | cnt2 | score | support | confidence | lift | z_score |
---|---|---|---|---|---|---|---|---|---|
Consumer | Small Business | 13 | 13 | 17 | 0.764705882352941 | 0.764705882352941 | 1 | 1 | -0.98058067569092 |
Consumer | Corporate | 13 | 13 | 17 | 0.764705882352941 | 0.764705882352941 | 1 | 1 | -0.98058067569092 |
Consumer | Home Office | 13 | 13 | 16 | 0.8125 | 0.764705882352941 | 1 | 1.0625 | -0.98058067569092 |
Corporate | Consumer | 13 | 17 | 13 | 0.764705882352941 | 0.764705882352941 | 0.764705882352941 | 1 | -0.98058067569092 |
Corporate | Home Office | 16 | 17 | 16 | 0.941176470588235 | 0.941176470588235 | 0.941176470588235 | 1 | 0.784464540552737 |
Corporate | Small Business | 17 | 17 | 17 | 1 | 1 | 1 | 1 | 1.37281294596729 |
Home Office | Consumer | 13 | 16 | 13 | 0.8125 | 0.764705882352941 | 0.8125 | 1.0625 | -0.98058067569092 |
Home Office | Small Business | 16 | 16 | 17 | 0.941176470588235 | 0.941176470588235 | 1 | 1 | 0.784464540552737 |
Home Office | Corporate | 16 | 16 | 17 | 0.941176470588235 | 0.941176470588235 | 1 | 1 | 0.784464540552737 |
Small Business | Consumer | 13 | 17 | 13 | 0.764705882352941 | 0.764705882352941 | 0.764705882352941 | 1 | -0.98058067569092 |
Small Business | Home Office | 16 | 17 | 16 | 0.941176470588235 | 0.941176470588235 | 0.941176470588235 | 1 | 0.784464540552737 |
Small Business | Corporate | 17 | 17 | 17 | 1 | 1 | 1 | 1 | 1.37281294596729 |