The Altair Community is migrating to a new platform to provide a better experience for you. The RapidMiner Community will merge with the Altair Community at the same time. In preparation for the migration, both communities are on read-only mode from July 15th - July 24th, 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.
Options

"Using Generate Attribute after Windowing Operator Error"

habibalexhabibalex Member Posts: 7 Contributor II
edited May 2019 in Help
I have to use the rename attribute operator after the windowing operator to successfully use the generate attribute operator.  This is because the windowing operator uses dashes ('-') instead of underscores ('_') when creating new attributes.

For example:
I have a dataset w/ a column name 'Close'
=> Windowing Operator, window size = 2. 
new data set has column names 'Close-0', 'Close-1'
When I use generate operator 'Close-0*2', I get an error: 'Unrecognized Symbol Close'

However if I rename the operator to 'Close_0' and then use generate operator w/ 'Close_0*2' it is fine.  Please update the windowing operator to account for this bug!




    <operator activated="true" class="series:windowing" compatibility="5.1.002" expanded="true" height="76" name="Windowing" width="90" x="179" y="30">
        <parameter key="horizon" value="1"/>
        <parameter key="window_size" value="2"/>
        <parameter key="create_single_attributes" value="false"/>
        <parameter key="create_label" value="true"/>
        <parameter key="label_attribute" value="Close"/>
      </operator>
<operator activated="true" class="rename" compatibility="5.1.006" expanded="true" height="76" name="Rename" width="90" x="284" y="155">
        <parameter key="old_name" value="Close-0"/>
        <parameter key="new_name" value="Close_0"/>
        <list key="rename_additional_attributes"/>
      </operator>
      <operator activated="true" class="generate_attributes" compatibility="5.1.006" expanded="true" height="76" name="Generate Attributes" width="90" x="313" y="30">
        <list key="function_descriptions">
          <parameter key="result" value="if(Close_0&gt;label,1,if(Close_0&lt;label,-1,0))"/>
        </list>
      </operator>

Answers

  • Options
    colocolo Member Posts: 236 Maven
    Hi habibalex,

    even if I would also prefer a way to mask/escape attribute names (in order to eliminate the limitations), this is no bug. Did you read the operator description? If you had, you would have found this information:

    Please note that there are some restrictions for the attribute names in order to let this operator work properly:
    • Attribute names containing parentheses are not allowed.
    • Attribute names containing blanks are not allowed
    • Attribute names with function or operator names are also not allowed.
    • If the standard constants (see below) are usable, attribute names with names like "e" or "pi" are not allowed.
    And the solution/workaround is also presented:

    If these conditions are not fulfilled, the names must be changed beforehand, for example with the Rename operator. When replacing several attributes following a certain schema, the Rename by Replacing migth prove useful.

    I would suggest using the "Rename by Replacing" operator to replace every minus sign by an underscore via regular expressions.

    Regards
    Matthias
Sign In or Register to comment.