计算百分比值

时间:2017-11-12 08:21:59

标签: rapidminer

我的Rapidminer流程结果发布如下

Row No. Count
1   9.0
2   11.0
3   32.0

如果我想计算:     (9/32)* 100和     (11/32)×100 从这个结果集中,我该怎么做?

1 个答案:

答案 0 :(得分:0)

解决方案不是很直接,因为RapidMiner通常将示例(行)视为彼此独立。

您可以做的是提取所需的值作为并在生成属性运算符中使用它。
有关特定问题的解决方案,请参阅随附的示例流程。只需将下面的XML复制并粘贴到RapidMiner中的流程窗口即可。

也可以在RapidMiner community forum

中进一步询问或重新发帖
<?xml version="1.0" encoding="UTF-8"?><process version="7.6.001">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="7.6.001" expanded="true" name="Process">
<process expanded="true">
  <operator activated="true" class="generate_data_user_specification" compatibility="7.6.001" expanded="true" height="68" name="Generate Data by User Specification" width="90" x="112" y="85">
    <list key="attribute_values">
      <parameter key="Count" value="9"/>
    </list>
    <list key="set_additional_roles"/>
  </operator>
  <operator activated="true" class="generate_data_user_specification" compatibility="7.6.001" expanded="true" height="68" name="Generate Data by User Specification (2)" width="90" x="112" y="187">
    <list key="attribute_values">
      <parameter key="Count" value="11"/>
    </list>
    <list key="set_additional_roles"/>
  </operator>
  <operator activated="true" class="generate_data_user_specification" compatibility="7.6.001" expanded="true" height="68" name="Generate Data by User Specification (3)" width="90" x="112" y="340">
    <list key="attribute_values">
      <parameter key="Count" value="32"/>
    </list>
    <list key="set_additional_roles"/>
  </operator>
  <operator activated="true" class="append" compatibility="7.6.001" expanded="true" height="124" name="Append" width="90" x="380" y="187"/>
  <operator activated="true" class="extract_macro" compatibility="7.6.001" expanded="true" height="68" name="Extract Macro" width="90" x="581" y="187">
    <parameter key="macro" value="divisor"/>
    <parameter key="macro_type" value="data_value"/>
    <parameter key="attribute_name" value="Count"/>
    <parameter key="example_index" value="3"/>
    <list key="additional_macros"/>
    <description align="center" color="green" colored="true" width="126">Extracting the third value as a macro. It can be the called using the %{macro_name} syntax</description>
  </operator>
  <operator activated="true" class="generate_attributes" compatibility="7.6.001" expanded="true" height="82" name="Generate Attributes" width="90" x="782" y="187">
    <list key="function_descriptions">
      <parameter key="Percentage" value="5"/>
    </list>
    <description align="center" color="green" colored="true" width="126">Creating a new Attribute (column) with the desired calculation&lt;br&gt;&lt;br&gt;Check the final paragraph of the help text for the &amp;quot;Generate Attribute&amp;quot; Operator for a description of how to work with macros</description>
  </operator>
  <connect from_op="Generate Data by User Specification" from_port="output" to_op="Append" to_port="example set 1"/>
  <connect from_op="Generate Data by User Specification (2)" from_port="output" to_op="Append" to_port="example set 2"/>
  <connect from_op="Generate Data by User Specification (3)" from_port="output" to_op="Append" to_port="example set 3"/>
  <connect from_op="Append" from_port="merged set" to_op="Extract Macro" to_port="example set"/>
  <connect from_op="Extract Macro" from_port="example set" to_op="Generate Attributes" to_port="example set input"/>
  <connect from_op="Generate Attributes" 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"/>
  <description align="center" color="yellow" colored="false" height="581" resized="true" width="444" x="56" y="18">Generating sample data to fit the original problem</description>
</process>
</operator>
</process>