【问题标题】:How to load transaction (basket) data in RapidMiner for association rule?如何在 RapidMiner 中为关联规则加载交易(篮子)数据?
【发布时间】:2016-04-04 10:39:48
【问题描述】:

我有项目集格式的逗号分隔交易(篮子)数据

citrus fruit,semi-finished,bread,margarine
tropical fruit,yogurt,coffee,milk
yogurt,cream,cheese,meat spreads
 etc

其中每一行表示在单个交易中购买的物品。 通过使用 Read.CSV 运算符,我在 RapidMiner 中加载了这个文件。我找不到任何运算符来转换此数据以进行 FP 增长和关联规则挖掘。

有什么方法可以在 RapidMiner 中读取此类文件进行关联规则挖掘?

【问题讨论】:

    标签: rapidminer market-basket-analysis


    【解决方案1】:

    我终于明白你的意思了——对不起,我说话太慢了。这可以使用文本处理扩展中的运算符来完成。您必须从 RapidMiner 存储库安装它。完成后,您可以尝试此过程。

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="7.0.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="7.0.000" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="read_csv" compatibility="7.0.000" expanded="true" height="68" name="Read CSV" width="90" x="246" y="85">
            <parameter key="csv_file" value="C:\Temp\is.txt"/>
            <parameter key="column_separators" value="\r\n"/>
            <parameter key="first_row_as_names" value="false"/>
            <list key="annotations"/>
            <parameter key="encoding" value="windows-1252"/>
            <list key="data_set_meta_data_information">
              <parameter key="0" value="att1.true.polynominal.attribute"/>
            </list>
          </operator>
          <operator activated="true" class="nominal_to_text" compatibility="7.0.000" expanded="true" height="82" name="Nominal to Text" width="90" x="380" y="85"/>
          <operator activated="true" class="text:process_document_from_data" compatibility="7.0.000" expanded="true" height="82" name="Process Documents from Data" width="90" x="514" y="85">
            <parameter key="vector_creation" value="Term Occurrences"/>
            <list key="specify_weights"/>
            <process expanded="true">
              <operator activated="true" class="text:tokenize" compatibility="7.0.000" expanded="true" height="68" name="Tokenize" width="90" x="45" y="34">
                <parameter key="mode" value="specify characters"/>
                <parameter key="characters" value=","/>
              </operator>
              <connect from_port="document" to_op="Tokenize" to_port="document"/>
              <connect from_op="Tokenize" from_port="document" to_port="document 1"/>
              <portSpacing port="source_document" spacing="0"/>
              <portSpacing port="sink_document 1" spacing="0"/>
              <portSpacing port="sink_document 2" spacing="0"/>
            </process>
          </operator>
          <connect from_op="Read CSV" from_port="output" to_op="Nominal to Text" to_port="example set input"/>
          <connect from_op="Nominal to Text" from_port="example set output" to_op="Process Documents from Data" to_port="example set"/>
          <connect from_op="Process Documents from Data" from_port="example set" 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>
    

    诀窍是使用Read CSV 读取原始文件,但使用行尾作为分隔符。这会将整行作为多项式属性读取。从那里,您必须将其转换为文本,以便文本处理操作员可以完成他们的工作。然后使用Process Documents from Data 运算符来制作最终的示例集。重要的一点是使用Tokenize 运算符将行拆分为用逗号分隔的单词。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-14
      • 1970-01-01
      • 2019-03-05
      • 2015-11-02
      • 2016-07-28
      • 2015-01-12
      相关资源
      最近更新 更多