RapidMiner

Problem with calculated field

SOLVED
Wisdom logo Registration now open for RapidMiner Wisdom Americas | New Orleans | October 10-12, 2018   Learn More

Problem with calculated field

hi

 

I am calculating the division between the number of seconds of a call "duracion" into 60 to turn them in minutes as a generated field (duracion/60), "duracion" is a integer type, but I get this error 

1 error(s):
Cannot create example set meta data: '/' must have arguments of type 'numerical'
I dont understand why
 
someone knows?
 
thanks
9 REPLIES

Re: Problem with calculated field

Hi @sebastian_gonza,

 

I am not able to reproduce this bug : Generate a new attribute from an attribute set as integer don't cause a problem here.

(however I raise this error if the attribute is set as nominal).

 

So could you share your process and your dataset(s) ?

 

Regards,

 

Lionel

 

Re: Problem with calculated field

Sure, in addition I have a problem with the pivot table but I guess it will be fixed once the problem with the calculation is ok.

Re: Problem with calculated field

@sebastian_gonza,

 

Have you tried ......to execute your process ....... ?

There is nothing wrong in your process, it works perfectly (although, in deed, the first Generate Attributes operator is displaying an error) : 

Divide_Integer.png

 

Regards,

 

Lionel

Highlighted

Re: Problem with calculated field

Yes, but the columns name should by the ranges that I created in "duracion_range" and the values I know is counting which is ok, but I want to add the duration in muntes which is calculated before but is not being processed in the workflow.

Re: Problem with calculated field

@sebastian_gonza,

 

Do you want a final result like this : 

Divide_Integer_2.png

 

if yes, remove the last Pivot operator

 

If I misunderstood, can you describe exactly what you want to obtain, by giving an example.

 

Regards,

 

 

Lionel

Unicorn
Unicorn

Re: Problem with calculated field

Sometimes this happens with macros---you can always force RapidMiner to treat an attribute as numerical (as long as it is a number) by using the eval() function and the attribute name in the Generate Attributes expression editor.

 

Brian T., Lindon Ventures - www.lindonventures.com
Analytics Consulting and Training by Certified RapidMiner Experts

Re: Problem with calculated field

something like this, each attribute of duration range as a column and the amount of call made by each id that are in that range

 

ID 8-0 min
1232424 12
1324850 3
23403412 1

Re: Problem with calculated field

something like this, each attribute of duration range as a column and the amount of call made by each id that are in that range

 

ID 8-0 min
1232424 12
1324850 3
23403412 1
Solution

Re: Problem with calculated field

Hi @sebastian_gonza,

 

It's a little far-fetched, but does this process help you ?

<?xml version="1.0" encoding="UTF-8"?><process version="8.2.000">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="8.2.000" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="subprocess" compatibility="8.2.000" expanded="true" height="82" name="llamadas" width="90" x="112" y="85">
        <process expanded="true">
          <operator activated="true" class="retrieve" compatibility="8.2.000" expanded="true" height="68" name="Retrieve base_mac" width="90" x="45" y="34">
            <parameter key="repository_entry" value="../data/base_mac"/>
          </operator>
          <operator activated="true" class="filter_examples" compatibility="8.2.000" expanded="true" height="103" name="Filter Examples (3)" width="90" x="246" y="34">
            <list key="filters_list">
              <parameter key="filters_entry_key" value="poid_type.contains.telephony"/>
            </list>
          </operator>
          <operator activated="true" class="multiply" compatibility="8.2.000" expanded="true" height="103" name="Multiply (12)" width="90" x="380" y="34"/>
          <operator activated="true" class="retrieve" compatibility="8.2.000" expanded="true" height="68" name="Retrieve llamadas_sample" width="90" x="45" y="187">
            <parameter key="repository_entry" value="../data/llamadas_sample"/>
          </operator>
          <operator activated="true" class="select_attributes" compatibility="8.2.000" expanded="true" height="82" name="Select Attributes (2)" width="90" x="246" y="187">
            <parameter key="attribute_filter_type" value="subset"/>
            <parameter key="attributes" value="duracion|numero_origen|numero_destino|sentido"/>
          </operator>
          <operator activated="true" class="multiply" compatibility="8.2.000" expanded="true" height="103" name="Multiply (11)" width="90" x="380" y="187"/>
          <operator activated="true" class="concurrency:join" compatibility="8.2.000" expanded="true" height="82" name="Join (20)" width="90" x="514" y="34">
            <parameter key="remove_double_attributes" value="false"/>
            <parameter key="use_id_attribute_as_key" value="false"/>
            <list key="key_attributes">
              <parameter key="service_id" value="numero_destino"/>
            </list>
            <parameter key="keep_both_join_attributes" value="true"/>
          </operator>
          <operator activated="true" class="concurrency:join" compatibility="8.2.000" expanded="true" height="82" name="Join (21)" width="90" x="514" y="187">
            <parameter key="remove_double_attributes" value="false"/>
            <parameter key="use_id_attribute_as_key" value="false"/>
            <list key="key_attributes">
              <parameter key="service_id" value="numero_origen"/>
            </list>
            <parameter key="keep_both_join_attributes" value="true"/>
          </operator>
          <operator activated="true" class="select_attributes" compatibility="8.2.000" expanded="true" height="82" name="Select Attributes (11)" width="90" x="648" y="34">
            <parameter key="attribute_filter_type" value="subset"/>
            <parameter key="attributes" value="account_no|duracion|sentido"/>
          </operator>
          <operator activated="true" class="select_attributes" compatibility="8.2.000" expanded="true" height="82" name="Select Attributes (12)" width="90" x="648" y="187">
            <parameter key="attribute_filter_type" value="subset"/>
            <parameter key="attributes" value="account_no|duracion|sentido"/>
          </operator>
          <operator activated="true" class="union" compatibility="8.2.000" expanded="true" height="82" name="Union" width="90" x="782" y="136"/>
          <operator activated="true" class="guess_types" compatibility="8.2.000" expanded="true" height="82" name="Guess Types" width="90" x="916" y="136">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="duracion"/>
          </operator>
          <operator activated="true" class="generate_attributes" compatibility="8.2.000" expanded="true" height="82" name="Generate Attributes (14)" width="90" x="1050" y="136">
            <list key="function_descriptions">
              <parameter key="duracion_min" value="duracion/60"/>
            </list>
          </operator>
          <operator activated="true" class="generate_attributes" compatibility="8.2.000" expanded="true" height="82" name="Generate Attributes (2)" width="90" x="1251" y="136">
            <list key="function_descriptions">
              <parameter key="duracion_range" value="if(duracion_min&gt;=0 &amp;&amp; duracion_min&lt;8,&quot;0-8 min&quot;,if(duracion_min&gt;=8 &amp;&amp; duracion_min&lt;16,&quot;8-16 min&quot;,if(duracion_min&gt;=16 &amp;&amp; duracion_min&lt;25,&quot;16-25 min&quot;,&quot;+25 min&quot;)))"/>
            </list>
          </operator>
          <operator activated="true" class="generate_attributes" compatibility="8.2.000" expanded="true" height="82" name="Generate Attributes (17)" width="90" x="1385" y="136">
            <list key="function_descriptions">
              <parameter key="ID" value="replace(account_no,&quot;.&quot;,&quot;&quot;)"/>
              <parameter key="ID_ok" value="if(length(ID)==8,concat(&quot;01&quot;,ID),ID)"/>
            </list>
          </operator>
          <operator activated="true" class="multiply" compatibility="8.2.000" expanded="true" height="82" name="Multiply (13)" width="90" x="1519" y="136"/>
          <operator activated="true" class="aggregate" compatibility="8.2.000" expanded="true" height="82" name="Aggregate" width="90" x="1653" y="136">
            <list key="aggregation_attributes">
              <parameter key="duracion_range" value="count"/>
            </list>
            <parameter key="group_by_attributes" value="duracion_range||ID"/>
          </operator>
          <operator activated="true" class="pivot" compatibility="8.2.000" expanded="true" height="82" name="Pivot" width="90" x="1787" y="136">
            <parameter key="group_attribute" value="duracion_range"/>
            <parameter key="index_attribute" value="ID"/>
            <parameter key="skip_constant_attributes" value="false"/>
          </operator>
          <operator activated="true" class="transpose" compatibility="8.2.000" expanded="true" height="82" name="Transpose" width="90" x="1452" y="340"/>
          <operator activated="true" class="rename_by_example_values" compatibility="8.2.000" expanded="true" height="82" name="Rename by Example Values" width="90" x="1586" y="340"/>
          <operator activated="true" class="rename" compatibility="8.2.000" expanded="true" height="82" name="Rename" width="90" x="1720" y="340">
            <parameter key="old_name" value="duracion_range"/>
            <parameter key="new_name" value="Id"/>
            <list key="rename_additional_attributes"/>
          </operator>
          <operator activated="true" class="replace" compatibility="8.2.000" expanded="true" height="82" name="Replace" width="90" x="1854" y="340">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="Id"/>
            <parameter key="include_special_attributes" value="true"/>
            <parameter key="replace_what" value=".*_"/>
          </operator>
          <connect from_op="Retrieve base_mac" from_port="output" to_op="Filter Examples (3)" to_port="example set input"/>
          <connect from_op="Filter Examples (3)" from_port="example set output" to_op="Multiply (12)" to_port="input"/>
          <connect from_op="Multiply (12)" from_port="output 1" to_op="Join (20)" to_port="left"/>
          <connect from_op="Multiply (12)" from_port="output 2" to_op="Join (21)" to_port="left"/>
          <connect from_op="Retrieve llamadas_sample" from_port="output" to_op="Select Attributes (2)" to_port="example set input"/>
          <connect from_op="Select Attributes (2)" from_port="example set output" to_op="Multiply (11)" to_port="input"/>
          <connect from_op="Multiply (11)" from_port="output 1" to_op="Join (20)" to_port="right"/>
          <connect from_op="Multiply (11)" from_port="output 2" to_op="Join (21)" to_port="right"/>
          <connect from_op="Join (20)" from_port="join" to_op="Select Attributes (11)" to_port="example set input"/>
          <connect from_op="Join (21)" from_port="join" to_op="Select Attributes (12)" to_port="example set input"/>
          <connect from_op="Select Attributes (11)" from_port="example set output" to_op="Union" to_port="example set 1"/>
          <connect from_op="Select Attributes (12)" from_port="example set output" to_op="Union" to_port="example set 2"/>
          <connect from_op="Union" from_port="union" to_op="Guess Types" to_port="example set input"/>
          <connect from_op="Guess Types" from_port="example set output" to_op="Generate Attributes (14)" to_port="example set input"/>
          <connect from_op="Generate Attributes (14)" from_port="example set output" to_op="Generate Attributes (2)" to_port="example set input"/>
          <connect from_op="Generate Attributes (2)" from_port="example set output" to_op="Generate Attributes (17)" to_port="example set input"/>
          <connect from_op="Generate Attributes (17)" from_port="example set output" to_op="Multiply (13)" to_port="input"/>
          <connect from_op="Multiply (13)" from_port="output 1" to_op="Aggregate" to_port="example set input"/>
          <connect from_op="Aggregate" from_port="example set output" to_op="Pivot" to_port="example set input"/>
          <connect from_op="Pivot" from_port="example set output" to_op="Transpose" to_port="example set input"/>
          <connect from_op="Transpose" from_port="example set output" to_op="Rename by Example Values" to_port="example set input"/>
          <connect from_op="Rename by Example Values" from_port="example set output" to_op="Rename" to_port="example set input"/>
          <connect from_op="Rename" from_port="example set output" to_op="Replace" to_port="example set input"/>
          <connect from_op="Replace" from_port="example set output" to_port="out 1"/>
          <portSpacing port="source_in 1" spacing="0"/>
          <portSpacing port="sink_out 1" spacing="0"/>
          <portSpacing port="sink_out 2" spacing="0"/>
        </process>
      </operator>
      <connect from_op="llamadas" from_port="out 1" 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>

Regards,

 

Lionel