Pages: [1]
  Print  
Author Topic: Date to Nominal Function  (Read 1425 times)
rowan.g
Newbie
*
Posts: 47


« on: May 08, 2013, 02:00:17 AM »

Hi,

Not sure if this has been requested. A Date-to-Nominal function for use in the Generate Attributes operator would be awesome!

Thanks for all the great work! Rapidminer is a fine piece of software! Keep it up1
Logged
Nils
Administrator
Sr. Member
*****
Posts: 409


« Reply #1 on: May 08, 2013, 08:28:03 AM »

Hi,

there are already multiple possibilities to accomplish this.

Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.009">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.3.009" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="generate_data_user_specification" compatibility="5.3.009" expanded="true" height="60" name="Generate Data by User Specification" width="90" x="112" y="30">
        <list key="attribute_values">
          <parameter key="nominal_date" value="&quot;2007-08-09 12:37:56&quot;"/>
        </list>
        <list key="set_additional_roles"/>
      </operator>
      <operator activated="true" class="generate_attributes" compatibility="5.3.009" expanded="true" height="76" name="Generate Attributes (2)" width="90" x="246" y="30">
        <list key="function_descriptions">
          <parameter key="nominal_to_data_old" value="nominal_date"/>
        </list>
      </operator>
      <operator activated="true" class="nominal_to_date" compatibility="5.3.009" expanded="true" height="76" name="Nominal to Date" width="90" x="380" y="30">
        <parameter key="attribute_name" value="nominal_date"/>
        <parameter key="date_type" value="date_time"/>
        <parameter key="date_format" value="yyyy-MM-dd HH:mm:ss"/>
      </operator>
      <operator activated="true" class="generate_data_user_specification" compatibility="5.3.009" expanded="true" height="60" name="Generate Data by User Specification (2)" width="90" x="112" y="165">
        <list key="attribute_values">
          <parameter key="nominal_date" value="&quot;2007-08-09 12:37:56&quot;"/>
        </list>
        <list key="set_additional_roles"/>
      </operator>
      <operator activated="true" class="generate_attributes" compatibility="5.3.009" expanded="true" height="76" name="Generate Attributes" width="90" x="246" y="165">
        <list key="function_descriptions">
          <parameter key="date" value="date_parse_custom(nominal_date, &quot;yyyy-MM-dd HH:mm:ss&quot;, &quot;de&quot;)"/>
        </list>
      </operator>
      <connect from_op="Generate Data by User Specification" from_port="output" to_op="Generate Attributes (2)" to_port="example set input"/>
      <connect from_op="Generate Attributes (2)" from_port="example set output" to_op="Nominal to Date" to_port="example set input"/>
      <connect from_op="Nominal to Date" from_port="example set output" to_port="result 1"/>
      <connect from_op="Generate Data by User Specification (2)" 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 2"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="18"/>
      <portSpacing port="sink_result 2" spacing="90"/>
      <portSpacing port="sink_result 3" spacing="0"/>
    </process>
  </operator>
</process>

Best,
Nils
Logged

Please add [SOLVED] to the topic title when your problem has been solved! (do so by editing the first post in the thread and modifying the title)
rowan.g
Newbie
*
Posts: 47


« Reply #2 on: May 09, 2013, 12:26:50 AM »

Sorry - didn't realise date parse custom was the operator to use.

Thanks!
Logged
Pages: [1]
  Print  
 
Jump to: