How to transfer mutual information matrix to attribute weights

qwertzqwertz Member Posts: 130 Contributor II
edited October 2019 in Help

Dear Rapidminer community,

I have a table of let's say 1 label and 5 regular attributes.

The goal is to write the mutual information between the label and each regular attribute as the weight of each regular attribute (e.g. mutual information between label and att1 = 2,452 -> This shall become the weight of att1; similar for att2 to att5).

So far I managed to write the mutual information to an excel file. (Which works though I have to admit that I don't really understand the necessaty to have the second report operator. But be it as it may.)

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.0.003">
  <operator activated="true" class="process" compatibility="6.0.003" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="generate_data" compatibility="6.0.003" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30"/>
      <operator activated="true" class="set_role" compatibility="6.0.003" expanded="true" height="76" name="Set Role" width="90" x="179" y="30">
        <parameter key="attribute_name" value="label"/>
        <list key="set_additional_roles"/>
      <operator activated="true" class="mututal_information_matrix" compatibility="6.0.003" expanded="true" height="76" name="Mutual Information Matrix" width="90" x="313" y="30"/>
      <operator activated="true" class="reporting:generate_report" compatibility="5.3.000" expanded="true" height="76" name="Generate Report" width="90" x="447" y="30">
        <parameter key="report_name" value="report"/>
        <parameter key="format" value="Excel"/>
        <parameter key="excel_output_file" value="C:\Users\Abc\Desktop\mutual information.xls"/>
      <operator activated="true" class="reporting:report" compatibility="5.3.000" expanded="true" height="60" name="Report" width="90" x="581" y="30">
        <parameter key="report_name" value="report"/>
        <parameter key="specified" value="true"/>
        <parameter key="reportable_type" value="Numerical Matrix"/>
        <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"/>
      <connect from_op="Generate Data" from_port="output" to_op="Set Role" to_port="example set input"/>
      <connect from_op="Set Role" from_port="example set output" to_op="Mutual Information Matrix" to_port="example set"/>
      <connect from_op="Mutual Information Matrix" from_port="matrix" to_op="Generate Report" to_port="through 1"/>
      <connect from_op="Generate Report" from_port="through 1" to_op="Report" to_port="reportable in"/>
      <connect from_op="Report" 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="0"/>
The point where I am struggling is to transfer the matrix output into weights.

Maybe it is not necessary to write a report file at all but at the moment I am totally stuck. Any help is greatly appreciated.



  • Options
    qwertzqwertz Member Posts: 130 Contributor II
    I was looking for a work.around to apply the matrix content as weight of the attributes but without success.

    The "data to weights" operator sounds promising but insteat of processing example input data it delivers "1" as weight for each and every attribute. (I wonder what the usecase of such operator is?)

    So it seems that there isn't any way to convert example data to weights?

    PS: I also posted a feature request in this matter http://rapid-i.com/rapidforum/index.php/topic,8062.0.html

    Kind regards
  • Options
    alal Member Posts: 10 Contributor II
    Joining the author,

    correctly working Data to Weights would be nice.

    Currenlty, however, handling weights manually is actually possible.  For instance, to manipulate weights and select attributes with desired weights you can do:

    [weights] -> Weights to data ->  [your manipulations] -> Sort -> Transpose -> Rename by Example Values -> Reorder Attributes -> Remove Attribute Range

    However this is too complicated  :-\
Sign In or Register to comment.