The Altair Community and the RapidMiner community is on read-only mode until further notice. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here.

# Average of 4 Weighting Criteria

Member Posts: 17 Contributor I
edited December 2018 in Help

hi

i am using 4 operator(weight by Information Gain, weight by Information Gain Ratio, weight by Gini Index, weight by Chi Square). then i need to have average of them for each features. i used different way with different operators but i could not solve this problem. what should i do? I'd appreciate it if you guided it.

Tagged:

## Best Answers

• RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,761 Unicorn
Solution Accepted

@m_gholami1991 I think you're looking for something like this below.

`<?xml version="1.0" encoding="UTF-8"?><process version="8.2.001">  <context>    <input/>    <output/>    <macros/>  </context>  <operator activated="true" class="process" compatibility="8.2.001" expanded="true" name="Process">    <process expanded="true">      <operator activated="true" class="subprocess" compatibility="8.2.001" expanded="true" height="82" name="Determine Influence Factors" width="90" x="313" y="34">        <process expanded="true">          <operator activated="true" class="weight_by_correlation" compatibility="8.2.001" expanded="true" height="82" name="Weight by Correlation" width="90" x="45" y="30"/>          <operator activated="true" class="weights_to_data" compatibility="8.2.001" expanded="true" height="68" name="Weights to Data" width="90" x="179" y="30"/>          <operator activated="true" class="generate_attributes" compatibility="6.4.000" expanded="true" height="82" name="Generate Attributes (2)" width="90" x="313" y="30">            <list key="function_descriptions">              <parameter key="Method" value="&quot;Correlation&quot;"/>            </list>          </operator>          <operator activated="true" class="weight_by_gini_index" compatibility="8.2.001" expanded="true" height="82" name="Weight by Gini Index" width="90" x="45" y="120"/>          <operator activated="true" class="weight_by_information_gain" compatibility="8.2.001" expanded="true" height="82" name="Weight by Information Gain" width="90" x="45" y="210"/>          <operator activated="true" class="weight_by_information_gain_ratio" compatibility="8.2.001" expanded="true" height="82" name="Weight by Information Gain Ratio" width="90" x="45" y="300"/>          <operator activated="true" class="weight_by_chi_squared_statistic" compatibility="8.2.001" expanded="true" height="82" name="Weight by Chi Squared Statistic (2)" width="90" x="45" y="442"/>          <operator activated="true" class="weights_to_data" compatibility="8.2.001" expanded="true" height="68" name="Weights to Data (2)" width="90" x="179" y="120"/>          <operator activated="true" class="generate_attributes" compatibility="6.4.000" expanded="true" height="82" name="Generate Attributes (3)" width="90" x="313" y="120">            <list key="function_descriptions">              <parameter key="Method" value="&quot;Gini&quot;"/>            </list>          </operator>          <operator activated="true" class="weights_to_data" compatibility="8.2.001" expanded="true" height="68" name="Weights to Data (3)" width="90" x="179" y="187"/>          <operator activated="true" class="generate_attributes" compatibility="6.4.000" expanded="true" height="82" name="Generate Attributes (4)" width="90" x="313" y="210">            <list key="function_descriptions">              <parameter key="Method" value="&quot;InfoGain&quot;"/>            </list>          </operator>          <operator activated="true" class="weights_to_data" compatibility="8.2.001" expanded="true" height="68" name="Weights to Data (4)" width="90" x="179" y="289"/>          <operator activated="true" class="generate_attributes" compatibility="6.4.000" expanded="true" height="82" name="Generate Attributes (5)" width="90" x="313" y="300">            <list key="function_descriptions">              <parameter key="Method" value="&quot;InfoGainRatio&quot;"/>            </list>          </operator>          <operator activated="true" class="weights_to_data" compatibility="8.2.001" expanded="true" height="68" name="Weights to Data (5)" width="90" x="179" y="442"/>          <operator activated="true" class="generate_attributes" compatibility="6.4.000" expanded="true" height="82" name="Generate Attributes (6)" width="90" x="313" y="453">            <list key="function_descriptions">              <parameter key="Method" value="&quot;Chi Square&quot;"/>            </list>          </operator>          <operator activated="true" class="append" compatibility="8.2.001" expanded="true" height="166" name="Append" width="90" x="447" y="30"/>          <operator activated="true" class="pivot" compatibility="8.2.001" expanded="true" height="82" name="Pivot" width="90" x="581" y="30">            <parameter key="group_attribute" value="Attribute"/>            <parameter key="index_attribute" value="Method"/>          </operator>          <operator activated="true" class="generate_aggregation" compatibility="6.5.002" expanded="true" height="82" name="Generate Aggregation" width="90" x="715" y="30">            <parameter key="attribute_name" value="Importance"/>            <parameter key="attribute_filter_type" value="value_type"/>            <parameter key="value_type" value="numeric"/>            <parameter key="aggregation_function" value="average"/>          </operator>          <operator activated="true" class="normalize" compatibility="7.5.003" expanded="true" height="103" name="Normalize" width="90" x="849" y="30">            <parameter key="attribute_filter_type" value="single"/>            <parameter key="attribute" value="Importance"/>            <parameter key="method" value="range transformation"/>          </operator>          <operator activated="true" class="sort" compatibility="8.2.001" expanded="true" height="82" name="Sort (2)" width="90" x="983" y="34">            <parameter key="attribute_name" value="Importance"/>            <parameter key="sorting_direction" value="decreasing"/>          </operator>          <operator activated="true" class="order_attributes" compatibility="8.2.001" expanded="true" height="82" name="Reorder Attributes (3)" width="90" x="1117" y="34">            <parameter key="attribute_ordering" value="Attribute|Importance"/>            <parameter key="handle_unmatched" value="remove"/>          </operator>          <connect from_port="in 1" to_op="Weight by Correlation" to_port="example set"/>          <connect from_op="Weight by Correlation" from_port="weights" to_op="Weights to Data" to_port="attribute weights"/>          <connect from_op="Weight by Correlation" from_port="example set" to_op="Weight by Gini Index" to_port="example set"/>          <connect from_op="Weights to Data" from_port="example set" to_op="Generate Attributes (2)" to_port="example set input"/>          <connect from_op="Generate Attributes (2)" from_port="example set output" to_op="Append" to_port="example set 1"/>          <connect from_op="Weight by Gini Index" from_port="weights" to_op="Weights to Data (2)" to_port="attribute weights"/>          <connect from_op="Weight by Gini Index" from_port="example set" to_op="Weight by Information Gain" to_port="example set"/>          <connect from_op="Weight by Information Gain" from_port="weights" to_op="Weights to Data (3)" to_port="attribute weights"/>          <connect from_op="Weight by Information Gain" from_port="example set" to_op="Weight by Information Gain Ratio" to_port="example set"/>          <connect from_op="Weight by Information Gain Ratio" from_port="weights" to_op="Weights to Data (4)" to_port="attribute weights"/>          <connect from_op="Weight by Information Gain Ratio" from_port="example set" to_op="Weight by Chi Squared Statistic (2)" to_port="example set"/>          <connect from_op="Weight by Chi Squared Statistic (2)" from_port="weights" to_op="Weights to Data (5)" to_port="attribute weights"/>          <connect from_op="Weights to Data (2)" from_port="example set" to_op="Generate Attributes (3)" to_port="example set input"/>          <connect from_op="Generate Attributes (3)" from_port="example set output" to_op="Append" to_port="example set 2"/>          <connect from_op="Weights to Data (3)" from_port="example set" to_op="Generate Attributes (4)" to_port="example set input"/>          <connect from_op="Generate Attributes (4)" from_port="example set output" to_op="Append" to_port="example set 3"/>          <connect from_op="Weights to Data (4)" from_port="example set" to_op="Generate Attributes (5)" to_port="example set input"/>          <connect from_op="Generate Attributes (5)" from_port="example set output" to_op="Append" to_port="example set 4"/>          <connect from_op="Weights to Data (5)" from_port="example set" to_op="Generate Attributes (6)" to_port="example set input"/>          <connect from_op="Generate Attributes (6)" from_port="example set output" to_op="Append" to_port="example set 5"/>          <connect from_op="Append" from_port="merged set" to_op="Pivot" to_port="example set input"/>          <connect from_op="Pivot" from_port="example set output" to_op="Generate Aggregation" to_port="example set input"/>          <connect from_op="Generate Aggregation" from_port="example set output" to_op="Normalize" to_port="example set input"/>          <connect from_op="Normalize" from_port="example set output" to_op="Sort (2)" to_port="example set input"/>          <connect from_op="Sort (2)" from_port="example set output" to_op="Reorder Attributes (3)" to_port="example set input"/>          <connect from_op="Reorder Attributes (3)" from_port="example set output" to_port="out 1"/>          <portSpacing port="source_in 1" spacing="0"/>          <portSpacing port="source_in 2" spacing="0"/>          <portSpacing port="sink_out 1" spacing="0"/>          <portSpacing port="sink_out 2" spacing="0"/>        </process>      </operator>      <portSpacing port="source_input 1" spacing="0"/>      <portSpacing port="sink_result 1" spacing="0"/>    </process>  </operator></process>`
• Moderator, RapidMiner Certified Analyst, Member Posts: 1,195 Unicorn
Solution Accepted

Hi again @m_gholami1991,

3 things :

1. First, I recommend you to update Rapidminer to the current version (version 8.2) : The process of @Thomas_Ott work fine here (I execute the process with the "Golf" dataset with RapidMiner 8.2). So when you said "But it is not and the Decision Tree Operator inside of Validation Operator makes an error", can you be more precise and ideally share your dataset in order we reproduce what you obtain.

2. What exactly do you want to do ?

I first understood that you want to "feed" the wei port of Select by Weights operator with the average of your 4 weights (and not only the Weight by Gini Index like in the process you shared... that's why I provided this process.....

3. You said "Which I think is for the version above 7"

If I good understood what you want to do and if you want absolutly execute "RapidMiner 7.1", update the parameters of the

Write Message operator (inside the Weight Data Converter Subprocess) :

I hope it helps,

Regards,

Lionel

## Answers

• Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,635 Unicorn

If you post your process XML and a sample data file it will be easier for the community to help you.  It's hard to work from a screen shot.

Brian T.
Lindon Ventures
Data Science Consulting from Certified RapidMiner Experts
• Member Posts: 17 Contributor I

Thanks, Right Know i am sending a sample file.

• Moderator, RapidMiner Certified Analyst, Member Posts: 1,195 Unicorn

Here a process which perform what you want to do :

`<?xml version="1.0" encoding="UTF-8"?><process version="8.2.001">  <context>    <input/>    <output/>    <macros/>  </context>  <operator activated="true" class="process" compatibility="8.2.001" expanded="true" name="Process">    <process expanded="true">      <operator activated="true" class="retrieve" compatibility="8.2.001" expanded="true" height="68" name="Retrieve Golf" width="90" x="45" y="85">        <parameter key="repository_entry" value="//Samples/data/Golf"/>      </operator>      <operator activated="true" class="multiply" compatibility="8.2.001" expanded="true" height="166" name="Multiply" width="90" x="179" y="85"/>      <operator activated="true" class="weight_by_chi_squared_statistic" compatibility="8.2.001" expanded="true" height="82" name="Weight by Chi Squared Statistic" width="90" x="313" y="544"/>      <operator activated="true" class="weights_to_data" compatibility="8.2.001" expanded="true" height="68" name="Weights to Data (4)" width="90" x="447" y="544"/>      <operator activated="true" class="rename_by_replacing" compatibility="8.2.001" expanded="true" height="82" name="Rename by Replacing (4)" width="90" x="581" y="544">        <parameter key="attribute_filter_type" value="single"/>        <parameter key="attribute" value="Weight"/>        <parameter key="replace_what" value="Weight"/>        <parameter key="replace_by" value="Weight_Chi_Square"/>      </operator>      <operator activated="true" class="weight_by_gini_index" compatibility="8.2.001" expanded="true" height="82" name="Weight by Gini Index" width="90" x="313" y="442"/>      <operator activated="true" class="weights_to_data" compatibility="8.2.001" expanded="true" height="68" name="Weights to Data (3)" width="90" x="447" y="442"/>      <operator activated="true" class="rename_by_replacing" compatibility="8.2.001" expanded="true" height="82" name="Rename by Replacing (3)" width="90" x="581" y="442">        <parameter key="attribute_filter_type" value="single"/>        <parameter key="attribute" value="Weight"/>        <parameter key="replace_what" value="Weight"/>        <parameter key="replace_by" value="Weight_Gini_Index"/>      </operator>      <operator activated="true" class="weight_by_information_gain_ratio" compatibility="8.2.001" expanded="true" height="82" name="Weight by Information Gain Ratio" width="90" x="313" y="340"/>      <operator activated="true" class="weights_to_data" compatibility="8.2.001" expanded="true" height="68" name="Weights to Data (2)" width="90" x="447" y="340"/>      <operator activated="true" class="rename_by_replacing" compatibility="8.2.001" expanded="true" height="82" name="Rename by Replacing (2)" width="90" x="581" y="340">        <parameter key="attribute_filter_type" value="single"/>        <parameter key="attribute" value="Weight"/>        <parameter key="replace_what" value="Weight"/>        <parameter key="replace_by" value="Weight_Info_Gain_Ratio"/>      </operator>      <operator activated="true" class="weight_by_information_gain" compatibility="8.2.001" expanded="true" height="82" name="Weight by Information Gain" width="90" x="313" y="238"/>      <operator activated="true" class="weights_to_data" compatibility="8.2.001" expanded="true" height="68" name="Weights to Data" width="90" x="447" y="238"/>      <operator activated="true" class="rename_by_replacing" compatibility="8.2.001" expanded="true" height="82" name="Rename by Replacing" width="90" x="581" y="238">        <parameter key="attribute_filter_type" value="single"/>        <parameter key="attribute" value="Weight"/>        <parameter key="replace_what" value="Weight"/>        <parameter key="replace_by" value="Weight_Info_Gain"/>      </operator>      <operator activated="true" class="concurrency:join" compatibility="8.2.001" expanded="true" height="82" name="Join" width="90" x="715" y="289">        <parameter key="use_id_attribute_as_key" value="false"/>        <list key="key_attributes">          <parameter key="Attribute" value="Attribute"/>        </list>      </operator>      <operator activated="true" class="concurrency:join" compatibility="8.2.001" expanded="true" height="82" name="Join (2)" width="90" x="782" y="391">        <parameter key="use_id_attribute_as_key" value="false"/>        <list key="key_attributes">          <parameter key="Attribute" value="Attribute"/>        </list>      </operator>      <operator activated="true" class="concurrency:join" compatibility="8.2.001" expanded="true" height="82" name="Join (3)" width="90" x="782" y="544">        <parameter key="use_id_attribute_as_key" value="false"/>        <list key="key_attributes">          <parameter key="Attribute" value="Attribute"/>        </list>      </operator>      <operator activated="true" class="generate_aggregation" compatibility="8.2.001" expanded="true" height="82" name="Generate Aggregation" width="90" x="916" y="493">        <parameter key="attribute_name" value="Weight"/>        <parameter key="attribute_filter_type" value="regular_expression"/>        <parameter key="regular_expression" value="Weight.*"/>        <parameter key="except_regular_expression" value="Attribute"/>        <parameter key="aggregation_function" value="average"/>      </operator>      <operator activated="true" class="select_attributes" compatibility="8.2.001" expanded="true" height="82" name="Select Attributes" width="90" x="916" y="340">        <parameter key="attribute_filter_type" value="regular_expression"/>        <parameter key="regular_expression" value="Weight_.*"/>        <parameter key="except_regular_expression" value="Attribute"/>        <parameter key="invert_selection" value="true"/>      </operator>      <operator activated="true" class="subprocess" compatibility="8.2.001" expanded="true" height="82" name="Weight Data Converter" width="90" x="849" y="187">        <process expanded="true">          <operator activated="true" class="set_macro" compatibility="8.2.001" expanded="true" height="82" name="Temp File Path" width="90" x="45" y="34">            <parameter key="macro" value="weight_file_path"/>            <parameter key="value" value="Desktop/average_weight.dat"/>          </operator>          <operator activated="true" class="generate_attributes" compatibility="8.2.001" expanded="true" height="82" name="Create Pseudo Attr" width="90" x="179" y="34">            <list key="function_descriptions">              <parameter key="_bas" value="&quot;&lt;weight name=&quot;"/>              <parameter key="_orta" value="&quot; value=&quot;"/>              <parameter key="_son" value="&quot;/&gt;&quot;"/>            </list>          </operator>          <operator activated="true" class="order_attributes" compatibility="8.2.001" expanded="true" height="82" name="ReOrder" width="90" x="313" y="34">            <parameter key="attribute_ordering" value="_bas|Attribute|_orta|Weight|_son"/>          </operator>          <operator activated="true" class="write_message" compatibility="8.2.001" expanded="true" height="82" name="Write Opening Tags" width="90" x="447" y="34">            <parameter key="file" value="%{weight_file_path}"/>            <parameter key="text" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;windows-1254&quot;?&gt;&#10;&#10;&lt;attributeweights version=&quot;8.2&quot;&gt;&#10;"/>          </operator>          <operator activated="true" class="write_special" compatibility="8.2.001" expanded="true" height="68" name="Write Weight Values" width="90" x="581" y="34">            <parameter key="example_set_file" value="%{weight_file_path}"/>            <parameter key="special_format" value="\$t\$a[&quot;]"/>            <parameter key="quote_nominal_values" value="false"/>            <parameter key="overwrite_mode" value="append"/>          </operator>          <operator activated="true" class="write_message" compatibility="8.2.001" expanded="true" height="82" name="Write Closing Tags" width="90" x="715" y="34">            <parameter key="file" value="%{weight_file_path}"/>            <parameter key="text" value="&lt;/attributeweights&gt;"/>            <parameter key="mode" value="append"/>          </operator>          <operator activated="true" class="legacy:read_weights" compatibility="8.2.001" expanded="true" height="68" name="Read Weight File" width="90" x="849" y="34">            <parameter key="attribute_weights_file" value="%{weight_file_path}"/>          </operator>          <connect from_port="in 1" to_op="Temp File Path" to_port="through 1"/>          <connect from_op="Temp File Path" from_port="through 1" to_op="Create Pseudo Attr" to_port="example set input"/>          <connect from_op="Create Pseudo Attr" from_port="example set output" to_op="ReOrder" to_port="example set input"/>          <connect from_op="ReOrder" from_port="example set output" to_op="Write Opening Tags" to_port="through 1"/>          <connect from_op="Write Opening Tags" from_port="through 1" to_op="Write Weight Values" to_port="input"/>          <connect from_op="Write Weight Values" from_port="through" to_op="Write Closing Tags" to_port="through 1"/>          <connect from_op="Read Weight File" from_port="output" to_port="out 1"/>          <portSpacing port="source_in 1" spacing="0"/>          <portSpacing port="source_in 2" spacing="0"/>          <portSpacing port="sink_out 1" spacing="0"/>          <portSpacing port="sink_out 2" spacing="0"/>        </process>      </operator>      <operator activated="true" class="select_by_weights" compatibility="8.2.001" expanded="true" height="103" name="Select by Weights" width="90" x="581" y="85"/>      <connect from_op="Retrieve Golf" from_port="output" to_op="Multiply" to_port="input"/>      <connect from_op="Multiply" from_port="output 1" to_op="Select by Weights" to_port="example set input"/>      <connect from_op="Multiply" from_port="output 2" to_op="Weight by Information Gain" to_port="example set"/>      <connect from_op="Multiply" from_port="output 3" to_op="Weight by Information Gain Ratio" to_port="example set"/>      <connect from_op="Multiply" from_port="output 4" to_op="Weight by Gini Index" to_port="example set"/>      <connect from_op="Multiply" from_port="output 5" to_op="Weight by Chi Squared Statistic" to_port="example set"/>      <connect from_op="Weight by Chi Squared Statistic" from_port="weights" to_op="Weights to Data (4)" to_port="attribute weights"/>      <connect from_op="Weights to Data (4)" from_port="example set" to_op="Rename by Replacing (4)" to_port="example set input"/>      <connect from_op="Rename by Replacing (4)" from_port="example set output" to_op="Join (3)" to_port="right"/>      <connect from_op="Weight by Gini Index" from_port="weights" to_op="Weights to Data (3)" to_port="attribute weights"/>      <connect from_op="Weights to Data (3)" from_port="example set" to_op="Rename by Replacing (3)" to_port="example set input"/>      <connect from_op="Rename by Replacing (3)" from_port="example set output" to_op="Join (2)" to_port="right"/>      <connect from_op="Weight by Information Gain Ratio" from_port="weights" to_op="Weights to Data (2)" to_port="attribute weights"/>      <connect from_op="Weights to Data (2)" from_port="example set" to_op="Rename by Replacing (2)" to_port="example set input"/>      <connect from_op="Rename by Replacing (2)" from_port="example set output" to_op="Join" to_port="right"/>      <connect from_op="Weight by Information Gain" from_port="weights" to_op="Weights to Data" to_port="attribute weights"/>      <connect from_op="Weights to Data" from_port="example set" to_op="Rename by Replacing" to_port="example set input"/>      <connect from_op="Rename by Replacing" from_port="example set output" to_op="Join" to_port="left"/>      <connect from_op="Join" from_port="join" to_op="Join (2)" to_port="left"/>      <connect from_op="Join (2)" from_port="join" to_op="Join (3)" to_port="left"/>      <connect from_op="Join (3)" from_port="join" to_op="Generate Aggregation" to_port="example set input"/>      <connect from_op="Generate Aggregation" from_port="example set output" to_op="Select Attributes" to_port="example set input"/>      <connect from_op="Select Attributes" from_port="example set output" to_op="Weight Data Converter" to_port="in 1"/>      <connect from_op="Weight Data Converter" from_port="out 1" to_op="Select by Weights" to_port="weights"/>      <connect from_op="Select by Weights" from_port="example set output" to_port="result 1"/>      <connect from_op="Select by Weights" from_port="weights" 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"/>    </process>  </operator></process>`

I used the "trick" (of a previous topic) which consist to "write" the weight table into a XML file and then read this file.

@sgenzer, this problem has already been discussed in a previous thread and this operation of conversion data -> weights

can be an improvment of the Data to Weights operator in a next release of RapidMiner.

Thanks you,

Regards,

Lionel

• Member Posts: 17 Contributor I

Mr. Thomas_Ot and Mr.lionelderkrikor

Thanks a lot that take you time for my problem. It is very valuable to me.  I check Mr. Thomas_Ot file and I understand whole step of that and run it on my file. But there a small problem. As you understand ,I want to get the precision of my experimental samples with “Validation” Operator. In fact, In addition to the Importance feature, other features are required as input to the “Validation”  Operator. But it is not and the Decision Tree Operator inside of Validation Operator makes an error. Because only Importance feature is known for Decision Tree.

• Member Posts: 17 Contributor I

Hi Mr.lionelderkrikor

Thaks again. i checked your file. On your file,there is a "Weight Data Convertor" Operator Which I think is for the version above 7. And I want to try to solve the problem with the existing version. my version is 7.1

• Member Posts: 17 Contributor I

hi

Thanks a lot. I update my rapidminer version to 8.2 and then i use the file that you send for me. thanks a lot that take your time for my problem. :smileyhappy:

• Moderator, RapidMiner Certified Analyst, Member Posts: 1,195 Unicorn

You're welcome.

Good continuation.

Regards,

Lionel

Sign In or Register to comment.