Problem with Fourier Transformation [SOLVED]

Pete84
Pete84 New Altair Community Member
edited November 5 in Community Q&A
Hey guys,

I am trying to do a simple Fourier Transformation with Rapidminer, but I have no luck for the last 3hours. Nevermind...
Here is the problem:
I have an Excel sheet with the following columns:

x               cos(x)     sin(x)
0,0000 1,0000 0
0,0491 0,9988 0,049067674
0,0982 0,9952 0,09801714
...
...
1,2272 0,3369 0,941544065
1,2763 0,2903 0,956940336
1,3254 0,2430 0,970031253
1,3744 0,1951 0,98078528
1,4235 0,1467 0,98917651
1,4726 0,0980 0,995184727
1,5217 0,0491 0,998795456
1,5708 0,0000 1
...
2,9943 -0,9892 0,146730474
3,0434 -0,9952 0,09801714
3,0925 -0,9988 0,049067674
3,1416 -1,0000 2,34296E-15
3,1907 -0,9988 -0,049067674
....
6,0868 0,9808 -0,195090322
6,1359 0,9892 -0,146730474
6,1850 0,9952 -0,09801714
6,2341 0,9988 -0,049067674
6,2832 1,0000 -1,26795E-14

and there the corresponding xml file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.0">
 <context>
   <input/>
   <output/>
   <macros/>
 </context>
 <operator activated="true" class="process" compatibility="5.0.10" expanded="true" name="Process">
   <process expanded="true" height="624" width="566">
     <operator activated="true" class="read_excel" compatibility="5.0.10" expanded="true" height="60" name="Read Excel" width="90" x="45" y="30">
       <parameter key="excel_file" value="C:\Dokumente und Einstellungen\pete\Desktop\test.xls"/>
       <parameter key="first_row_as_names" value="false"/>
       <list key="annotations"/>
       <list key="data_set_meta_data_information">
         <parameter key="0" value="attribute_0.true.4.regular"/>
         <parameter key="1" value="attribute_1.true.4.regular"/>
         <parameter key="2" value="attribute_2.true.4.regular"/>
       </list>
       <parameter key="attribute_names_already_defined" value="true"/>
     </operator>
     <operator activated="true" class="select_attributes" compatibility="5.0.10" expanded="true" height="76" name="Select Attributes" width="90" x="112" y="165">
       <parameter key="attribute_filter_type" value="subset"/>
       <parameter key="attribute" value="attribute_2"/>
       <parameter key="attributes" value="attribute_2"/>
     </operator>
     <operator activated="true" class="fourier_transformation" compatibility="5.0.10" expanded="true" height="76" name="Fourier Transformation" width="90" x="313" y="120"/>
     <connect from_op="Read Excel" from_port="output" to_op="Select Attributes" to_port="example set input"/>
     <connect from_op="Select Attributes" from_port="example set output" to_op="Fourier Transformation" to_port="example set input"/>
     <connect from_op="Fourier Transformation" 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"/>
   </process>
 </operator>
</process>
Should I get normally a peak at 1hz for the sinus curve? After running the process I can the in the "DataView" 64 rows, the frequency from 0 increasing to 20.210 in 64 steps, but the fft(attribute2) still has the "?" symbol...

What is wrong wiht my process?

Regards,
pete :)
Tagged:

Answers

  • Andrew2
    Andrew2 New Altair Community Member
    Hello Pete,

    You need to include a label attribute. The help says
    "Uses the label as function of each attribute and calculates the fourier transformations as new attributes"
    There's a confusing word order thing happening here but my interpretation is that the attribute is assumed to be a function of the label.

    Use a Set Role operator to change attribute x to a label you will find the question marks will go away.

    regards

    Andrew
  • SebastianLoh
    SebastianLoh New Altair Community Member
    Hi Pete84,

    awchisholm is right, the input of the FFT operator needs also a label attribute (see operator description). In your case you need to set the role of the sin(x) attribute to label.

    See also the example process below:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.0">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.0.10" expanded="true" name="Process">
        <process expanded="true" height="624" width="815">
          <operator activated="true" class="generate_data" compatibility="5.0.8" expanded="true" height="60" name="Generate Data" width="90" x="45" y="75">
            <parameter key="target_function" value="simple sinus"/>
            <parameter key="number_examples" value="1000"/>
            <parameter key="number_of_attributes" value="1"/>
            <parameter key="attributes_lower_bound" value="0.0"/>
          </operator>
          <operator activated="true" class="sort" compatibility="5.0.8" expanded="true" height="76" name="Sort" width="90" x="179" y="75">
            <parameter key="attribute_name" value="att1"/>
          </operator>
          <operator activated="true" class="set_role" compatibility="5.0.8" expanded="true" height="76" name="Set Role (2)" width="90" x="313" y="75">
            <parameter key="name" value="att1"/>
          </operator>
          <operator activated="true" class="set_role" compatibility="5.0.8" expanded="true" height="76" name="Set Role" width="90" x="447" y="75">
            <parameter key="name" value="label"/>
            <parameter key="target_role" value="label"/>
          </operator>
          <operator activated="true" class="fourier_transformation" compatibility="5.0.10" expanded="true" height="76" name="Fourier Transformation" width="90" x="581" y="75"/>
          <connect from_op="Generate Data" from_port="output" to_op="Sort" to_port="example set input"/>
          <connect from_op="Sort" from_port="example set output" to_op="Set Role (2)" to_port="example set input"/>
          <connect from_op="Set Role (2)" from_port="example set output" to_op="Set Role" to_port="example set input"/>
          <connect from_op="Set Role" from_port="example set output" to_op="Fourier Transformation" to_port="example set input"/>
          <connect from_op="Fourier Transformation" 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"/>
        </process>
      </operator>
    </process>
    Ciao Sebastian.
  • Pete84
    Pete84 New Altair Community Member
    awesome, problem solved :) topic can be closed...