github.com/vlifesystems/rulehunter@v0.0.0-20180501090014-673078aa4a83/examples/experiments/acmeprinters_repair016_who_should_call_which_segment.yaml (about) 1 title: "Who should call which segment?" 2 category: "acme" 3 tags: 4 - repair 5 - sales 6 - printers 7 train: 8 dataset: 9 csv: 10 filename: "csv/printer_repairs_callerstats.csv" 11 hasHeader: true 12 separator: "," 13 fields: 14 - name 15 - segment 16 - conversion 17 - callTime 18 - numContacts 19 - value 20 when: "!hasRun || sinceLastRunMinutes > 40" 21 ruleGeneration: 22 fields: 23 - name 24 - segment 25 combinationLength: 2 26 aggregators: 27 - name: "totalContacts" 28 kind: "sum" 29 arg: "numContacts" 30 - name: "totalClientValue" 31 kind: "sum" 32 arg: "value" 33 # 5% commission on all repair contracts 34 - name: "totalClientCommission" 35 kind: "calc" 36 arg: "totalClientValue * 0.05" 37 # £2 charge per contact 38 - name: "totalClientContactCharge" 39 kind: "calc" 40 arg: "totalContacts * 2" 41 - name: "totalClientCharge" 42 kind: "calc" 43 arg: "totalClientCommission + totalClientContactCharge" 44 - name: "totalClientROI" 45 kind: "calc" 46 arg: "iferr(roundto(totalClientValue / totalClientCharge, 2), 0)" 47 - name: "totalCallCentreCost" 48 kind: "sum" 49 # £0.04/min call cost, plus £10/hr caller cost, plus £10/hr overheads 50 # Equal: (0.04/60) + (10/60/60) + (10/60/60) = 0.0062 51 arg: "callTime * 0.0062" 52 - name: "totalCallCentreProfit" 53 kind: "calc" 54 arg: "totalClientCharge - totalCallCentreCost" 55 - name: "meanConversion" 56 kind: "mean" 57 arg: "conversion" 58 - name: "totalCallCentreROI" 59 kind: "calc" 60 arg: "iferr(roundto(totalClientCharge / totalCallCentreCost, 2), 0)" 61 goals: 62 - "totalCallCentreROI >= 1.10" 63 - "totalClientROI >= 15" 64 - "meanConversion > 0.25" 65 - "totalCallCentreROI >= 1.30" 66 sortOrder: 67 - aggregator: "goalsScore" 68 direction: "descending" 69 - aggregator: "totalClientValue" 70 direction: "descending" 71 - aggregator: "totalCallCentreROI" 72 direction: "descending" 73 - aggregator: "meanConversion" 74 direction: "descending"