Options

True and false to one and zero

bernardo_pagnonbernardo_pagnon Member, University Professor Posts: 64 University Professor
Hello,

I am doing a simple market basket analysis example using the famous bakery data set. The data comes in as integer, I convert it to binomial and then run FP-growth, which works fine. I wanted to see zeros and ones in the example, not true or false, and I used the Map operator to change it. It did not work. 

Here is the process: 

<?xml version="1.0" encoding="UTF-8"?><process version="9.6.000">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="9.6.000" expanded="true" name="Process">
    <parameter key="logverbosity" value="init"/>
    <parameter key="random_seed" value="2001"/>
    <parameter key="send_mail" value="never"/>
    <parameter key="notification_email" value=""/>
    <parameter key="process_duration_for_mail" value="30"/>
    <parameter key="encoding" value="SYSTEM"/>
    <process expanded="true">
      <operator activated="true" class="retrieve" compatibility="9.6.000" expanded="true" height="68" name="Retrieve Bakery5000-out2" width="90" x="45" y="34">
        <parameter key="repository_entry" value="../../data/Bakery5000-out2"/>
      </operator>
      <operator activated="true" class="numerical_to_binominal" compatibility="9.6.000" expanded="true" height="82" name="Numerical to Binominal" width="90" x="45" y="136">
        <parameter key="attribute_filter_type" value="all"/>
        <parameter key="attribute" value=""/>
        <parameter key="attributes" value=""/>
        <parameter key="use_except_expression" value="false"/>
        <parameter key="value_type" value="numeric"/>
        <parameter key="use_value_type_exception" value="false"/>
        <parameter key="except_value_type" value="real"/>
        <parameter key="block_type" value="value_series"/>
        <parameter key="use_block_type_exception" value="false"/>
        <parameter key="except_block_type" value="value_series_end"/>
        <parameter key="invert_selection" value="false"/>
        <parameter key="include_special_attributes" value="false"/>
        <parameter key="min" value="0.0"/>
        <parameter key="max" value="0.0"/>
      </operator>
      <operator activated="true" class="map" compatibility="9.6.000" expanded="true" height="82" name="Map" width="90" x="112" y="238">
        <parameter key="attribute_filter_type" value="all"/>
        <parameter key="attribute" value=""/>
        <parameter key="attributes" value=""/>
        <parameter key="use_except_expression" value="false"/>
        <parameter key="value_type" value="attribute_value"/>
        <parameter key="use_value_type_exception" value="false"/>
        <parameter key="except_value_type" value="time"/>
        <parameter key="block_type" value="attribute_block"/>
        <parameter key="use_block_type_exception" value="false"/>
        <parameter key="except_block_type" value="value_matrix_row_start"/>
        <parameter key="invert_selection" value="false"/>
        <parameter key="include_special_attributes" value="false"/>
        <list key="value_mappings">
          <parameter key="true" value="1"/>
          <parameter key="false" value="0"/>
        </list>
        <parameter key="consider_regular_expressions" value="false"/>
        <parameter key="add_default_mapping" value="false"/>
      </operator>
      <operator activated="true" class="concurrency:fp_growth" compatibility="9.6.000" expanded="true" height="82" name="FP-Growth" width="90" x="313" y="289">
        <parameter key="input_format" value="items in dummy coded columns"/>
        <parameter key="item_separators" value="|"/>
        <parameter key="use_quotes" value="false"/>
        <parameter key="quotes_character" value="&quot;"/>
        <parameter key="escape_character" value="\"/>
        <parameter key="trim_item_names" value="true"/>
        <parameter key="positive_value" value="true"/>
        <parameter key="min_requirement" value="support"/>
        <parameter key="min_support" value="0.005"/>
        <parameter key="min_frequency" value="100"/>
        <parameter key="min_items_per_itemset" value="1"/>
        <parameter key="max_items_per_itemset" value="0"/>
        <parameter key="max_number_of_itemsets" value="1000000"/>
        <parameter key="find_min_number_of_itemsets" value="true"/>
        <parameter key="min_number_of_itemsets" value="100"/>
        <parameter key="max_number_of_retries" value="15"/>
        <parameter key="requirement_decrease_factor" value="0.9"/>
        <enumeration key="must_contain_list"/>
      </operator>
      <operator activated="true" class="create_association_rules" compatibility="9.6.000" expanded="true" height="82" name="Create Association Rules" width="90" x="447" y="85">
        <parameter key="criterion" value="lift"/>
        <parameter key="min_confidence" value="0.9"/>
        <parameter key="min_criterion_value" value="2.0"/>
        <parameter key="gain_theta" value="2.0"/>
        <parameter key="laplace_k" value="1.0"/>
      </operator>
      <connect from_op="Retrieve Bakery5000-out2" from_port="output" to_op="Numerical to Binominal" to_port="example set input"/>
      <connect from_op="Numerical to Binominal" from_port="example set output" to_op="Map" to_port="example set input"/>
      <connect from_op="Map" from_port="example set output" to_op="FP-Growth" to_port="example set"/>
      <connect from_op="FP-Growth" from_port="example set" to_port="result 3"/>
      <connect from_op="FP-Growth" from_port="frequent sets" to_op="Create Association Rules" to_port="item sets"/>
      <connect from_op="Create Association Rules" from_port="rules" to_port="result 1"/>
      <connect from_op="Create Association Rules" from_port="item sets" to_port="result 2"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
      <portSpacing port="sink_result 3" spacing="0"/>
      <portSpacing port="sink_result 4" spacing="0"/>
    </process>
  </operator>
</process>

Best Answer

Answers

  • Options
    varunm1varunm1 Moderator, Member Posts: 1,207 Unicorn
    Hello @bernardo_pagnon

    Can you provide the dataset, so that we can replicate and check ?
    Regards,
    Varun
    https://www.varunmandalapu.com/

    Be Safe. Follow precautions and Maintain Social Distancing

  • Options
    bernardo_pagnonbernardo_pagnon Member, University Professor Posts: 64 University Professor
    Sure, there it is. It is probably something silly, but I have to say whenever I use Map or Replace bad things happen in RM...
  • Options
    varunm1varunm1 Moderator, Member Posts: 1,207 Unicorn
    edited April 2020
    It worked fine for me. The before and after images of output below. I didn't change anything in your code.


    Regards,
    Varun
    https://www.varunmandalapu.com/

    Be Safe. Follow precautions and Maintain Social Distancing

  • Options
    bernardo_pagnonbernardo_pagnon Member, University Professor Posts: 64 University Professor
    Thanks varunm1. Hmmm, that is strange, I don't what could it be then. I got the following error: 



    Any clues?
  • Options
    bernardo_pagnonbernardo_pagnon Member, University Professor Posts: 64 University Professor
    Thanks varunm1!!!
Sign In or Register to comment.