Categories

Versions

You are viewing the RapidMiner Studio documentation for version 9.7 - Check here for latest version

Reorder Attributes (RapidMiner Studio Core)

Synopsis

This operator allows to reorder regular Attributes of an ExampleSet. Reordering can be done alphabetically, by user specification (including Regular Expressions) or with a reference ExampleSet.

Description

This operator allows to change the ordering of regular Attributes of an ExampleSet. Therefore, two different order modes may be selected in the parameter sort_mode. If sort mode alphabetically is chosen attributes are sorted alphabetically according to the selected sort_direction. If sort mode user specified is chosen the user can specify rules that define how attributes should be ordered. If sort mode reference data is chosen the input ExampleSet will be sorted according to the order of reference ExampleSet. Note that special attributes will not be considered by this operator. If they also should be reordered set them to regular with Set Role operator before.

Input

  • example set (IOObject)

    This input port expects an ExampleSet. It is output of the Retrieve operator in the attached Example Process. The output of other operators can also be used as input. It is essential that meta data should be attached with the data for input because attributes are specified in their meta data. The Retrieve operator provides meta data along-with data.

  • reference data (IOObject)

    This input port expects an ExampleSet. If sort mode is set to reference data and this port is connected, the ExampleSet from first port sorted will be sorted according to the order of attributes from this ExampleSet.

Output

  • example set (IOObject)

    The ExampleSet with reordered attributes is output of this port.

  • original (IOObject)

    The ExampleSet that was given as input is passed without changing to the output through this port. This is usually used to reuse the same ExampleSet in further operators or to view the ExampleSet in the Results Workspace.

Parameters

  • sort_mode This parameter allows you to select the method you want to use for reordering attributes. It has the following options:
    • user specified: This option allows to specify rules that define how the attributes should be reordered. When this option is selected another parameter (attribute ordering) becomes visible in the Parameters panel. This is the default option.
    • alphabetically: This option simply reorders all regular attributes alphabetically according to the selected sort direction.
    • reference data: This option allows to reorder all regular attributes according to the order of all regular attributes of the reference ExampleSet. If special attributes should also be considered, set them to regular before using this operator.
    Range: selection
  • sort_direction The direction of matched attribute groups to be sorted. If sort mode is alphabetically all regular attributes are sorted according to this direction. If sort mode is user specified, attributes that match a Regular Expression and all unmachted attributes are sorted according to this parameter. Moreover if sort mode is set to reference data all attributes that could not be found in the reference ExampleSet are sorted according to this parameter.
    • ascending: Sort attribute names ascending. This is the default option.
    • descending: Sort attribute names descending.
    • none: Apply no sorting at all.
    Range: selection
  • attribute_ordering This parameter allows the user to specify rules that define how attributes should be ordered. If the parameter use regular expressions is checked all specified rules are treated as Regular Expressions. Range: string
  • handle_unmachted Defines how unmachted attributes should be handled. Unmachted attributes can occur if one or more Attribute do not match the rules that the user did provide with the attribute ordering parameter or if one or more Attribute cannot be found in the reference ExampleSet. If they are kept (prepend,append) they will be sorted according to the selected sort direction.
    • append: Append all attributes that are not covered by the provided sorting rules.
    • prepend: Prepend all attributes that are not covered by the provided sorting rules.
    • remove: Remove all attributes that are not covered by the provided sorting rules.
    Range: selection
  • use_regular_expressions If this parameter is checked all rules created with the attribute ordering parameter are treated as Regular Expressions. Range: boolean

Tutorial Processes

Selecting attributes by specifying regular expressions matching their names

In the given Example process the Labor-Negotiations ExampleSet is loaded using the Retrieve operator. Then Reorder Attribute operator is applied on it. Have a look at the Parameters panel of the Reorder Attributes operator. Here is a stepwise explanation of this process. The sort mode parameter is set to 'user specified'. This allows the user to specify exact rules on how the attributes should be ordered. The attribute ordering parameter has two rules set. First rule is 'contrib-.*' and second rule is '.*-.*' The first rule 'contrib-.*' that attributes starting with 'contrib-' should be ordered in front. Since this expression matches two attributes both are sorted in descending order (see sort direction). '.*-.*' means all attributes that have a '-' in their name without those that already have been matched be the first rule. Only duration, pension and vacation do not match these two rules. They are also sorted according to the sort direction and appended like it is defined with the handle unmachted parameter.