The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
generate attribute
michaelgloven
RapidMiner Certified Analyst, Member Posts: 46 Guru
Probably a simple question, but I could not find relevant documentation. What is the correct syntax in Generate Attributes for combining multiple attributes into one? For example, how do I combine a numerical, nominal and date field to give me a new attribute field that looks like this: "2015 - Excellent - March 2015" as the new concatenated field? The attribute fields are 2015 (integer [field 1]), Excellent (nominal [field 2]) and March 2015 (date [field 3])...
thanks in advance!
Tagged:
0
Best Answer
-
lionelderkrikor RapidMiner Certified Analyst, Member Posts: 1,195 Unicorn
Hi again @michaelgloven,
Have you try the Generate Concatenation operator ?
Here an example :
Regards,
Lionel
<?xml version="1.0" encoding="UTF-8"?><process version="8.0.001">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="6.0.002" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="generate_nominal_data" compatibility="8.0.001" expanded="true" height="68" name="Generate Nominal Data" width="90" x="112" y="120">
<parameter key="number_examples" value="9800"/>
</operator>
<operator activated="true" class="multiply" compatibility="8.0.001" expanded="true" height="124" name="Multiply" width="90" x="246" y="136"/>
<operator activated="true" class="generate_concatenation" compatibility="8.0.001" expanded="true" height="82" name="Generate Concatenation" width="90" x="514" y="340">
<parameter key="first_attribute" value="att1"/>
<parameter key="second_attribute" value="att3"/>
<parameter key="separator" value="-"/>
</operator>
<operator activated="true" class="generate_concatenation" compatibility="8.0.001" expanded="true" height="82" name="Generate Concatenation (2)" width="90" x="648" y="340">
<parameter key="first_attribute" value="att2"/>
<parameter key="second_attribute" value="att1-att3"/>
<parameter key="separator" value="-"/>
</operator>
<operator activated="true" class="rename" compatibility="8.0.001" expanded="true" height="82" name="Rename" width="90" x="782" y="340">
<parameter key="old_name" value="att2-att1-att3"/>
<parameter key="new_name" value="concat"/>
<list key="rename_additional_attributes"/>
</operator>
<connect from_op="Generate Nominal Data" from_port="output" to_op="Multiply" to_port="input"/>
<connect from_op="Multiply" from_port="output 1" to_port="result 1"/>
<connect from_op="Multiply" from_port="output 2" to_op="Generate Concatenation" to_port="example set input"/>
<connect from_op="Multiply" from_port="output 3" to_port="result 2"/>
<connect from_op="Generate Concatenation" from_port="example set output" to_op="Generate Concatenation (2)" to_port="example set input"/>
<connect from_op="Generate Concatenation (2)" from_port="example set output" to_op="Rename" to_port="example set input"/>
<connect from_op="Rename" from_port="example set output" to_port="result 3"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
<portSpacing port="sink_result 3" spacing="0"/>
<portSpacing port="sink_result 4" spacing="0"/>
</process>
</operator>
</process>2
Answers
Hi @michaelgloven,
Here an example of a process that can maybe meet your needs ? :
Regards,
Lionel
There is a CONCAT function in Generate Attributes, but it will work only with nominals, so you need to first turn your other attributes (or copies of them if you want to keep the originals) into nominal form, using Date to Nominal and Numeric to Nominal.
Lindon Ventures
Data Science Consulting from Certified RapidMiner Experts
ah, I was not aware of this specific operator...thanks, it solves my issue!
Mike
Neither was I---and it's always amazing to find these little nuggets after using RapidMiner for so many years!
Lindon Ventures
Data Science Consulting from Certified RapidMiner Experts
Hi,
I'm using RapidMiner since a few months and I assure you, I discovered this operator today too :
When I saw this post, I decided to type "concat" in the operator search box and "Generate Concatenation" operator appeared "as if by magic"...
Best regards,
Lionel
stay tuned - we're about to put that search box on steroids.
Scott
@sgenzer, @lionelderkrikor, @Telcontar120, I had to use Generate Concatentation once and boy was it handy. It's like that wierd tool in your tool box that just sits there forever and you wonder why you bought it in the first place. Then you need it one day and boy were to glad it was there.
Hmm I have not found that operator extremely handy - it only handles two atts at a time. It would be FAR more useful if you could expand. I almost always use concat() in Generate Attributes.
Scott