"Export (FP growth) frequentitemsets output into a CSV table"

sebastian_gonzasebastian_gonza RapidMiner Certified Analyst, Member Posts: 52 Guru
edited May 2019 in Help



I tried exporting the result from (FP growth) frequentitemsets of the operator create association rules into a CSV file but I cant write it since it is not an object that can be converted to a table, how else can I do it if it is possible?


Thank you


Best Answers

  • Options
    JEdwardJEdward RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 578 Unicorn
    Solution Accepted

    You can use the Reporting extension to extract it into an Excel document.  Here's an example.


    <?xml version="1.0" encoding="UTF-8"?><process version="9.0.002">
    <operator activated="true" class="process" compatibility="9.0.002" expanded="true" name="Process" origin="GENERATED_TEMPLATE">
    <parameter key="encoding" value="SYSTEM"/>
    <process expanded="true">
    <operator activated="true" class="retrieve" compatibility="9.0.002" expanded="true" height="68" name="Load Transactions" origin="GENERATED_TEMPLATE" width="90" x="112" y="187">
    <parameter key="repository_entry" value="//Samples/Templates/Market Basket Analysis/Transactions"/>
    <operator activated="true" class="aggregate" compatibility="6.0.006" expanded="true" height="82" name="Aggregate" origin="GENERATED_TEMPLATE" width="90" x="112" y="336">
    <list key="aggregation_attributes">
    <parameter key="Orders" value="sum"/>
    <parameter key="group_by_attributes" value="Invoice|product 1"/>
    <operator activated="true" class="pivot" compatibility="9.0.002" expanded="true" height="82" name="Pivot" origin="GENERATED_TEMPLATE" width="90" x="246" y="336">
    <parameter key="group_attribute" value="Invoice"/>
    <parameter key="index_attribute" value="product 1"/>
    <operator activated="true" class="rename_by_replacing" compatibility="9.0.002" expanded="true" height="82" name="Rename by Replacing" origin="GENERATED_TEMPLATE" width="90" x="380" y="336">
    <parameter key="attribute" value="Invoice"/>
    <parameter key="replace_what" value="sum\(Orders\)_"/>
    <operator activated="true" class="replace_missing_values" compatibility="9.0.002" expanded="true" height="103" name="Replace Missing Values" origin="GENERATED_TEMPLATE" width="90" x="112" y="442">
    <parameter key="default" value="zero"/>
    <list key="columns"/>
    <operator activated="true" class="numerical_to_binominal" compatibility="6.0.003" expanded="true" height="82" name="Numerical to Binominal" origin="GENERATED_TEMPLATE" width="90" x="246" y="442"/>
    <operator activated="true" class="set_role" compatibility="9.0.002" expanded="true" height="82" name="Set Role" origin="GENERATED_TEMPLATE" width="90" x="380" y="442">
    <parameter key="attribute_name" value="Invoice"/>
    <parameter key="target_role" value="id"/>
    <list key="set_additional_roles"/>
    <operator activated="true" class="concurrency:fp_growth" compatibility="9.0.002" expanded="true" height="82" name="FP-Growth" origin="GENERATED_TEMPLATE" width="90" x="648" y="289">
    <parameter key="positive_value" value="true"/>
    <parameter key="min_support" value="0.005"/>
    <parameter key="find_min_number_of_itemsets" value="false"/>
    <enumeration key="must_contain_list"/>
    <operator activated="true" class="reporting:generate_report" compatibility="5.3.000" expanded="true" height="82" name="Generate Report" width="90" x="581" y="391">
    <parameter key="report_name" value="myReport"/>
    <parameter key="format" value="Excel"/>
    <parameter key="excel_output_file" value="C:\Users\Administrator\Desktop\myReport.xls"/>
    <operator activated="true" class="create_association_rules" compatibility="9.0.002" expanded="true" height="82" name="Create Association Rules" origin="GENERATED_TEMPLATE" width="90" x="715" y="493">
    <parameter key="min_confidence" value="0.1"/>
    <operator activated="true" class="reporting:report" compatibility="5.3.000" expanded="true" height="68" name="Report" width="90" x="782" y="391">
    <parameter key="report_name" value="myReport"/>
    <parameter key="report_item_header" value="myExcel"/>
    <parameter key="specified" value="true"/>
    <parameter key="reportable_type" value="Frequent Item Sets"/>
    <parameter key="renderer_name" value="Table View"/>
    <list key="parameters">
    <parameter key="min_row" value="1"/>
    <parameter key="max_row" value="2147483647"/>
    <parameter key="min_column" value="1"/>
    <parameter key="max_column" value="2147483647"/>
    <parameter key="sort_column" value="2147483647"/>
    <parameter key="sort_decreasing" value="false"/>
    <operator activated="true" class="reporting:report" compatibility="5.3.000" expanded="true" height="68" name="Report (2)" width="90" x="849" y="289">
    <parameter key="report_name" value="myReport"/>
    <parameter key="report_item_header" value="myExcel2"/>
    <parameter key="specified" value="true"/>
    <parameter key="reportable_type" value="Frequent Item Sets"/>
    <parameter key="renderer_name" value="Annotations"/>
    <list key="parameters"/>
    <connect from_op="Load Transactions" from_port="output" to_op="Aggregate" to_port="example set input"/>
    <connect from_op="Aggregate" from_port="example set output" to_op="Pivot" to_port="example set input"/>
    <connect from_op="Pivot" from_port="example set output" to_op="Rename by Replacing" to_port="example set input"/>
    <connect from_op="Rename by Replacing" from_port="example set output" to_op="Replace Missing Values" to_port="example set input"/>
    <connect from_op="Replace Missing Values" from_port="example set output" to_op="Numerical to Binominal" to_port="example set input"/>
    <connect from_op="Numerical to Binominal" from_port="example set output" to_op="Set Role" to_port="example set input"/>
    <connect from_op="Set Role" from_port="example set output" to_op="FP-Growth" to_port="example set"/>
    <connect from_op="FP-Growth" from_port="frequent sets" to_op="Generate Report" to_port="through 1"/>
    <connect from_op="Generate Report" from_port="through 1" to_op="Create Association Rules" to_port="item sets"/>
    <connect from_op="Create Association Rules" from_port="item sets" to_op="Report" to_port="reportable in"/>
    <connect from_op="Report" from_port="reportable out" to_op="Report (2)" to_port="reportable in"/>
    <connect from_op="Report (2)" from_port="reportable out" to_port="result 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="0"/>
    <portSpacing port="sink_result 2" spacing="147"/>
    <description align="left" color="yellow" colored="false" height="70" resized="false" width="850" x="20" y="25">MARKET BASKET ANALYSIS&lt;br&gt;Model associations between products by determining sets of items frequently purchased together and building association rules to derive recommendations.</description>
    <description align="left" color="blue" colored="true" height="185" resized="true" width="550" x="20" y="105">Step 1:&lt;br/&gt;Load transaction data containing a transaction id, a product id and a quantifier. The data denotes how many times a certain product has been purchased as part of a transactions.</description>
    <description align="left" color="purple" colored="true" height="341" resized="true" width="549" x="20" y="300">&lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; Step 2:&lt;br&gt;Edit, transform &amp;amp; load (ETL) - Aggregate transaction data to account for multiple occurrences of the same product in a transaction. Pivot the data so that each transaction is represented by a row. Transform purchase amounts to binary &amp;quot;product purchased yes/no &amp;quot; indicators.&lt;br&gt;</description>
    <description align="left" color="green" colored="true" height="310" resized="true" width="290" x="580" y="105">Step 3:&lt;br/&gt;Using FP-Growth, determine frequent item sets. A frequent item sets denotes that the items (products) in the set have been purchased together frequently, i.e. in a certain ratio of transactions. This ratio is given by the support of the item set.</description>
    <description align="left" color="green" colored="true" height="215" resized="true" width="286" x="579" y="425">&lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; Step 4:&lt;br/&gt;Create association rules which can be used for product recommendations depending on the confidences of the rules.&lt;br&gt;</description>
    <description align="left" color="yellow" colored="false" height="35" resized="true" width="849" x="20" y="655">Outputs: association rules, frequent item set&lt;br&gt;</description>


  • Options
    MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,520 RM Data Scientist
    Solution Accepted


    converters extension got a converter for it to get it into an example set which can be written to anything.




    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany


  • Options
    kdafoekdafoe Member Posts: 20 Maven
    Hi Martin.
    I know this is a little old, but could share what actual Converters Extension allows me to output the
    FP-Growth.frequent sets from the FP-Growth operator? I can use the one for association rules, but I can't find anything that works with frequency sets. Thanks, and I appreciate your knowledge share on the forum. 

  • Options
    MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,520 RM Data Scientist
    Hi @kdafoe ,
    yes there is. The operator is called 'Item Sets to Data' and is part of the normal studio.


    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
Sign In or Register to comment.