github.com/vlifesystems/rulehunter@v0.0.0-20180501090014-673078aa4a83/examples/experiments/acmeprinters_repair016_how_many_callbacks.yaml (about)

     1  title: "How many callbacks to make per segment?"
     2  category: "acme"
     3  tags:
     4    - repair
     5    - sales
     6    - printers
     7  train:
     8    dataset:
     9      csv:
    10        filename: "csv/printer_repairs_callbacks.csv"
    11        hasHeader: true
    12        separator: ","
    13      fields:
    14        - callbacks
    15        - segment
    16        - callTime
    17        - isComplete
    18        - isContact
    19        - value
    20    when: "!hasRun || sinceLastRunMinutes > 40"
    21    ruleGeneration:
    22      fields:
    23        - callbacks
    24        - segment
    25      combinationLength: 1
    26  aggregators:
    27    - name: "totalContacts"
    28      kind: "count"
    29      arg: "isContact"
    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: "numSignups"
    48      kind: "count"
    49      arg: "value > 0"
    50    - name: "totalCallCentreCost"
    51      kind: "sum"
    52      # £0.04/min call cost, plus £10/hr caller cost, plus £10/hr overheads
    53      # Equal: (0.04/60) + (10/60/60) + (10/60/60) = £0.0062/second
    54      arg: "callTime * 0.0062"
    55    - name: "totalCallCentreProfit"
    56      kind: "calc"
    57      arg: "totalClientCharge - totalCallCentreCost"
    58    - name: "conversion"
    59      kind: "calc"
    60      arg: "iferr(roundto(numSignups/totalContacts, 2), 0)"
    61    - name: "totalCallCentreROI"
    62      kind: "calc"
    63      arg: "iferr(roundto(totalClientCharge/totalCallCentreCost, 2), 0)"
    64  goals:
    65    - "totalCallCentreROI >= 1.10"
    66    - "totalClientROI >= 15"
    67    - "conversion > 0.25"
    68    - "totalCallCentreROI >= 1.30"
    69  sortOrder:
    70    - aggregator: "goalsScore"
    71      direction: "descending"
    72    - aggregator: "totalClientValue"
    73      direction: "descending"
    74    - aggregator: "totalCallCentreROI"
    75      direction: "descending"
    76    - aggregator: "conversion"
    77      direction: "descending"
    78  rules:
    79    - "(callbacks <= 5  && in(segment,\"a\",\"d\",\"f\",\"g\")) || (callbacks <= 9 && in(segment,\"b\",\"c\",\"e\"))"