Average of 4 Weighting Criteria
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.
Best Answers
-
Thomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,761 Unicorn
@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=""Correlation""/>
</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=""Gini""/>
</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=""InfoGain""/>
</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=""InfoGainRatio""/>
</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=""Chi Square""/>
</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>0 -
lionelderkrikor RapidMiner Certified Analyst, Member Posts: 1,195 Unicorn
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
0
Answers
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.
Lindon Ventures
Data Science Consulting from Certified RapidMiner Experts
Thanks, Right Know i am sending a sample file.
Hi @m_gholami1991,
Here a process which perform what you want to do :
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
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.
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
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:
Hi @m_gholami1991,
You're welcome.
Good continuation.
Regards,
Lionel