Does anyone have a process for RFM that can be shared for use ?

cwoocwoo Member Posts: 10 Contributor II
edited November 2018 in Help

Best Answers

  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Solution Accepted

    Hi,

     

    nowadays it's even simpler: You simply copy the above XML to clipboard (take care to get everything but not more) and then simply click into the process and press CTRL+V. Notice that it will override the current process there without asking.

     

    Greetings,

      Sebastian

  • cwoocwoo Member Posts: 10 Contributor II
    Solution Accepted

    Hi Sebastian ,

     

    I tried it it works  and  copied and pasted into  the blank  process sheet and it generated all the processes  fantastic.  I ran the code on some test data .  

     

    However i  got different code  not from martin  but  this  one works to  score the data with RFM codes.


    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.005">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.005" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="read_csv" compatibility="5.3.005" expanded="true" height="60" name="Read CSV" width="90" x="45" y="30">
            <parameter key="csv_file" value="/Users/Carlos/Desktop/test-rfm.csv"/>
            <parameter key="column_separators" value=","/>
            <parameter key="first_row_as_names" value="false"/>
            <list key="annotations">
              <parameter key="0" value="Name"/>
            </list>
            <parameter key="encoding" value="MacRoman"/>
            <list key="data_set_meta_data_information">
              <parameter key="0" value="id.true.integer.id"/>
              <parameter key="1" value="Recency.true.integer.attribute"/>
              <parameter key="2" value="Frequency.true.integer.attribute"/>
              <parameter key="3" value="Monetary.true.integer.attribute"/>
              <parameter key="4" value="Purchase.true.integer.label"/>
            </list>
          </operator>
          <operator activated="true" class="discretize_by_frequency" compatibility="5.3.005" expanded="true" height="94" name="Discretize-R" width="90" x="45" y="210">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="Recency"/>
            <parameter key="number_of_bins" value="5"/>
            <parameter key="range_name_type" value="short"/>
          </operator>
          <operator activated="true" class="nominal_to_numerical" compatibility="5.3.005" expanded="true" height="94" name="Nominal to Numerical" width="90" x="45" y="345">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="Recency"/>
            <parameter key="coding_type" value="unique integers"/>
            <list key="comparison_groups"/>
          </operator>
          <operator activated="true" class="discretize_by_frequency" compatibility="5.3.005" expanded="true" height="94" name="Discretize-F" width="90" x="179" y="210">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="Frequency"/>
            <parameter key="number_of_bins" value="5"/>
            <parameter key="range_name_type" value="short"/>
          </operator>
          <operator activated="true" class="nominal_to_numerical" compatibility="5.3.005" expanded="true" height="94" name="Nominal to Numerical (2)" width="90" x="179" y="345">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="Frequency"/>
            <parameter key="coding_type" value="unique integers"/>
            <list key="comparison_groups"/>
          </operator>
          <operator activated="true" class="discretize_by_frequency" compatibility="5.3.005" expanded="true" height="94" name="Discretize-M" width="90" x="313" y="210">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="Monetary"/>
            <parameter key="number_of_bins" value="5"/>
            <parameter key="range_name_type" value="short"/>
          </operator>
          <operator activated="true" class="nominal_to_numerical" compatibility="5.3.005" expanded="true" height="94" name="Nominal to Numerical (3)" width="90" x="313" y="345">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="Monetary"/>
            <parameter key="coding_type" value="unique integers"/>
            <list key="comparison_groups"/>
          </operator>
          <operator activated="true" class="generate_attributes" compatibility="5.3.005" expanded="true" height="76" name="GenerateRFM-Score" width="90" x="447" y="210">
            <list key="function_descriptions">
              <parameter key="rfm_score" value="100*(5-Recency)+10*(Frequency+1)+(Monetary+1)"/>
            </list>
          </operator>
          <connect from_op="Read CSV" from_port="output" to_op="Discretize-R" to_port="example set input"/>
          <connect from_op="Discretize-R" from_port="example set output" to_op="Nominal to Numerical" to_port="example set input"/>
          <connect from_op="Nominal to Numerical" from_port="example set output" to_op="Discretize-F" to_port="example set input"/>
          <connect from_op="Discretize-F" from_port="example set output" to_op="Nominal to Numerical (2)" to_port="example set input"/>
          <connect from_op="Nominal to Numerical (2)" from_port="example set output" to_op="Discretize-M" to_port="example set input"/>
          <connect from_op="Discretize-M" from_port="example set output" to_op="Nominal to Numerical (3)" to_port="example set input"/>
          <connect from_op="Nominal to Numerical (3)" from_port="example set output" to_op="GenerateRFM-Score" to_port="example set input"/>
          <connect from_op="GenerateRFM-Score" from_port="example set output" to_port="result 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
        </process>
      </operator>
    </process>
     

Answers

  • MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,503 RM Data Scientist

    Hi Cwoo,

     

    can you maybe help me and tell me what RFM is?

     

    ~Martin

    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,635 Unicorn

    Martin, Typically it is a reference to Recency, Frequency, and Monetary value, used in a simple marketing segmentation model.  See more here:

    https://en.wikipedia.org/wiki/RFM_(customer_value)

     

    Cwoo, I have done several RFM-type models in RapidMiner--what exactly are you looking to do with it?  The good news is that they are easy to build in RapidMiner.  The bad news is that they don't generlalize well because the cutoffs for the buckets and the values of the resulting cells tend to be very specific to your dataset.  You probably would want to do some exploratory data analysis first to figure out how many different segments you want for each of recency, frequency, and monetary value, using the binning operators.  You can then define some cutoffs and run historical revenue or profit summaries for the resulting cells using the aggregate operators, and you should have a usable solution.  

     

    Brian T.
    Lindon Ventures 
    Data Science Consulting from Certified RapidMiner Experts
  • cwoocwoo Member Posts: 10 Contributor II

      RFM  is  a segmentation prediction model to predict  profitable  customers most likely  to  respond to an offer  by  identifying  certain cells in the database  that have been  scored  based  on three  attributes  - Recency , Frequency  and monetary. Each  attribute is  sorted into quintiles  ( 1- 5 )  so  RFM code  for a record  will look  like    555 for the most frequent , most frequent and most spent  in the distribution  111   will be the worst customer. 

     

    A test sample  ( nth selection  sample )  and  control  group   will be  established and  direct mail offer is mailed to the test sample  and the  cell and sales responses are recorded.  The  responses  are then  appended to the  test  file  and the profitable cells  are identified based on the cells  that  have  break even  or more  profit.   

     

    Once the profitable cells have been identified in the  test file  . the next step will be to rollout to the larger file master file which was scored by RFM codes  so only mail to the profitbale RFM cells identified  in the  test sample (  Trained ) 

     

    The  result is  a higher ROI   for the direct mail program  because  you are only mailing  offers to the profitable  cells.  

     

    This method is a simle prediciton model  but very effecctive  it have been used in Direct marketing for over 25 years. 

    The person who taught this was arthur hughs  see website   

    http://www.dbmarketing.com/articles/Art149.htm

    http://www.dbmarketing.com/Software/RFM42/rfm_for_windows.htm  

    Download the manual for more detail .


    @mschmitz wrote:

    Hi Cwoo,

     

    can you maybe help me and tell me what RFM is?

     

    ~Martin


     

     

    Colin 

     

     

     

     

    The cells  that have been responded to that was profitable  , will then be rolled out to the larger  master file  hence  increasing the ROI  by  not mailing to the non responsive and unprofitable cells.  It is  used  when  introducing a  new product . 

     

     

    1) R  how  recent  a product/ service  was  purchased 

    2) F  how frequent  a product/service   was purchased

    3)  M  how much  was spent  monetary  was purchased

     

    An  nth  selection sample is made and 

  • MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,503 RM Data Scientist

    Hi cwoo,

     

    now i get it. I even built a "model" like this once. You might want to have a look at the attached proicess. I would really recommend to do it with something more complex.

     

    ~ Martin

     

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="7.1.001">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="7.1.001" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="subprocess" compatibility="7.1.001" expanded="true" height="82" name="Subprocess" width="90" x="112" y="120">
    <process expanded="true">
    <operator activated="true" class="generate_data" compatibility="7.1.001" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30">
    <parameter key="number_of_attributes" value="3"/>
    </operator>
    <operator activated="true" class="rename" compatibility="7.1.001" expanded="true" height="76" name="Rename" width="90" x="447" y="30">
    <parameter key="old_name" value="att1"/>
    <parameter key="new_name" value="Recency"/>
    <list key="rename_additional_attributes">
    <parameter key="att2" value="Frequency"/>
    <parameter key="att3" value="Monetary "/>
    </list>
    </operator>
    <operator activated="true" class="generate_attributes" compatibility="7.1.001" expanded="true" height="76" name="Generate Attributes" width="90" x="581" y="30">
    <list key="function_descriptions">
    <parameter key="Frequency" value="round(5*Frequency)"/>
    <parameter key="Monetary" value="10*[Monetary ]"/>
    </list>
    </operator>
    <connect from_op="Generate Data" from_port="output" to_op="Rename" to_port="example set input"/>
    <connect from_op="Rename" from_port="example set output" to_op="Generate Attributes" to_port="example set input"/>
    <connect from_op="Generate Attributes" from_port="example set output" to_port="out 1"/>
    <portSpacing port="source_in 1" spacing="0"/>
    <portSpacing port="sink_out 1" spacing="0"/>
    <portSpacing port="sink_out 2" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" breakpoints="after" class="discretize_by_frequency" compatibility="7.1.001" expanded="true" height="103" name="Discretize (3)" width="90" x="246" y="120">
    <parameter key="number_of_bins" value="5"/>
    </operator>
    <operator activated="true" class="aggregate" compatibility="7.1.001" expanded="true" height="82" name="Aggregate" width="90" x="380" y="120">
    <list key="aggregation_attributes">
    <parameter key="label" value="average"/>
    </list>
    <parameter key="group_by_attributes" value="Monetary|Frequency|Recency"/>
    </operator>
    <connect from_op="Subprocess" from_port="out 1" to_op="Discretize (3)" to_port="example set input"/>
    <connect from_op="Discretize (3)" from_port="example set output" to_op="Aggregate" to_port="example set input"/>
    <connect from_op="Aggregate" from_port="example set output" to_port="result 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="0"/>
    <portSpacing port="sink_result 2" spacing="0"/>
    </process>
    </operator>
    </process>

     

    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • cwoocwoo Member Posts: 10 Contributor II

    Thanks Martin

     

    However,  how   do i use the code  you sent in rapid miner  ?  

     

    What menu  so i go into  to import this  code and save this as  a process ?

     

     

    Colin 

     

     

  • MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,503 RM Data Scientist

    Colin,

     

    you can add the XML Panel via View->Show Panel->XML. You can simply copy and replace the new XML code into it and hit the small green arrow.

     

    ~Martin

    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • cwoocwoo Member Posts: 10 Contributor II

    How  do i  attach  a file to send to you .

  • cwoocwoo Member Posts: 10 Contributor II

    I  went to the show pannel  and  it does not have XML.

Sign In or Register to comment.