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
Cannot create example set meta data: '/' must have arguments of type 'numerical'
Best Answer
-
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>=0 && duracion_min<8,"0-8 min",if(duracion_min>=8 && duracion_min<16,"8-16 min",if(duracion_min>=16 && duracion_min<25,"16-25 min","+25 min")))"/>
</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,".","")"/>
<parameter key="ID_ok" value="if(length(ID)==8,concat("01",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
0
Answers
-
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
0 -
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.
0 -
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) :
Regards,
Lionel
0 -
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.
0 -
Do you want a final result like this :
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
0 -
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.
0 -
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 0 -
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 0 -
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>=0 && duracion_min<8,"0-8 min",if(duracion_min>=8 && duracion_min<16,"8-16 min",if(duracion_min>=16 && duracion_min<25,"16-25 min","+25 min")))"/>
</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,".","")"/>
<parameter key="ID_ok" value="if(length(ID)==8,concat("01",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
0