Date Format

PapadPapad Computer Science StudentMember Posts: 68  Guru
Hi everyone,
I have a dataset about sales which contains sales for every day.
I want to predict future sales so I want to merge the dataset I have into weeks in order to have better results.
How can I transform days to weeks and having each time all attributes added?
Thanks in advance.
Tagged:

Best Answer

Answers

  • sgenzersgenzer 12Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,876  Community Manager
    hi @Papad you'll do this in Generate Attributes. I do this all the time. Something like this:

    <?xml version="1.0" encoding="UTF-8"?><process version="9.2.001">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="9.2.001" expanded="true" name="Process">
        <parameter key="logverbosity" value="init"/>
        <parameter key="random_seed" value="-1"/>
        <parameter key="send_mail" value="never"/>
        <parameter key="notification_email" value=""/>
        <parameter key="process_duration_for_mail" value="30"/>
        <parameter key="encoding" value="SYSTEM"/>
        <process expanded="true">
          <operator activated="true" class="utility:create_exampleset" compatibility="9.2.001" expanded="true" height="68" name="Create ExampleSet" width="90" x="45" y="34">
            <parameter key="generator_type" value="date series"/>
            <parameter key="number_of_examples" value="100"/>
            <parameter key="use_stepsize" value="true"/>
            <list key="function_descriptions"/>
            <parameter key="add_id_attribute" value="false"/>
            <list key="numeric_series_configuration"/>
            <list key="date_series_configuration">
              <parameter key="date" value="2018-01-01 00:00:00."/>
            </list>
            <list key="date_series_configuration (interval)">
              <parameter key="date" value="2018-01-01 00:00:00.1.day"/>
            </list>
            <parameter key="date_format" value="yyyy-MM-dd HH:mm:ss"/>
            <parameter key="time_zone" value="America/New_York"/>
            <parameter key="column_separator" value=","/>
            <parameter key="parse_all_as_nominal" value="false"/>
            <parameter key="decimal_point_character" value="."/>
            <parameter key="trim_attribute_names" value="true"/>
          </operator>
          <operator activated="true" class="generate_attributes" compatibility="9.2.001" expanded="true" height="82" name="Generate Attributes" width="90" x="179" y="34">
            <list key="function_descriptions">
              <parameter key="yearWeek" value="100*date_get(date,DATE_UNIT_YEAR)+date_get(date,DATE_UNIT_WEEK)"/>
            </list>
            <parameter key="keep_all" value="true"/>
          </operator>
          <connect from_op="Create ExampleSet" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
          <connect from_op="Generate Attributes" 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>
    



    Scott
    Papaddbabrauskaite
  • PapadPapad Computer Science Student Member Posts: 68  Guru
    @sgenzer Thanks for your answer.
    What I really want to do in not only to show in each row which week we talk about.
    I want my dataset to be merged. For example, Jan 1 - Jan 7 are seven rows but I want it in one as Week1 and all the attributes added to each other automatically. Is there any way to do this?
    Thanks again.
Sign In or Register to comment.