Moving average example

wesselwessel Member Posts: 537 Maven
edited November 2018 in Help
Could anyone give me an example on how to apply a moving average to a normal dataset?

Do I really need to create a series object?

An example of a normal dataset:
- csv file
- 3 numeric attributes
- first row attribute names
- second row values at time step 1
- third row values at time step 2
- fourth row values at time step 3, ..., etc

Answers

  • SebastianLohSebastianLoh Member Posts: 99 Contributor II
    Hi wessel,

    check out this process, it might answer your question:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.0">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" expanded="true" name="Process">
        <process expanded="true" height="586" width="366">
          <operator activated="true" class="generate_data" expanded="true" height="60" name="Generate Data" width="90" x="45" y="75">
            <parameter key="number_of_attributes" value="3"/>
          </operator>
          <operator activated="true" class="write_csv" expanded="true" height="60" name="Write CSV" width="90" x="179" y="75">
            <parameter key="csv_file" value="C:\Users\SebastianLoh\Documents\test.csv"/>
          </operator>
          <operator activated="true" class="read_csv" expanded="true" height="60" name="Read CSV" width="90" x="45" y="210">
            <parameter key="file_name" value="C:\Users\SebastianLoh\Documents\test.csv"/>
          </operator>
          <operator activated="true" class="series:moving_average" expanded="true" height="76" name="Moving Average" width="90" x="246" y="210">
            <parameter key="attribute_name" value="att1"/>
          </operator>
          <operator activated="true" class="series:moving_average" expanded="true" height="76" name="Moving Average (2)" width="90" x="246" y="345">
            <parameter key="attribute_name" value="att2"/>
          </operator>
          <operator activated="true" class="series:moving_average" expanded="true" height="76" name="Moving Average (3)" width="90" x="246" y="480">
            <parameter key="attribute_name" value="att3"/>
          </operator>
          <connect from_op="Generate Data" from_port="output" to_op="Write CSV" to_port="input"/>
          <connect from_op="Read CSV" from_port="output" to_op="Moving Average" to_port="example set input"/>
          <connect from_op="Moving Average" from_port="example set output" to_op="Moving Average (2)" to_port="example set input"/>
          <connect from_op="Moving Average (2)" from_port="example set output" to_op="Moving Average (3)" to_port="example set input"/>
          <connect from_op="Moving Average (3)" 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
Sign In or Register to comment.