Sort (RapidMiner Studio Core)

Synopsis

This operator sorts the input ExampleSet in ascending or descending order according to a single attribute.

Description

This operator sorts the ExampleSet provided at the input port. The complete data set is sorted according to a single attribute. This attribute is specified using the attribute name parameter. Sorting is done in increasing or decreasing direction depending on the setting of the sorting direction parameter.

Input

  • example set input (Data Table)

    This input port expects an ExampleSet. It is output of the Retrieve operator in the attached Example Process.

Output

  • example set output (Data Table)

    The sorted ExampleSet is output of this port.

  • original (Data Table)

    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

  • attribute_nameThis parameter is used to specify the attribute which should be used for sorting the ExampleSet. Range: string
  • sorting_directionThis parameter indicates the direction of the sorting. The ExampleSet can be sorted in increasing(ascending) or decreasing(descending) order. Range:

Tutorial Processes

Sorting the Golf data set according to Temperature

The 'Golf' data set is loaded using the Retrieve operator. The Sort operator is applied on it. The attribute name parameter is set to 'Temperature'. The sort direction parameter is set to 'increasing'. Thus the 'Golf' data set is sorted in ascending order of the 'Temperature' attribute. The example with the smallest value of the 'Temperature' attribute becomes the first example and the example with the largest value of the 'Temperature' attribute becomes the last example of the ExampleSet.

Sorting on multiple attributes

This Example Process shows how two Sort operators can be used to sort an ExampleSet on two attributes. The 'Golf' data set is loaded using the Retrieve operator. The Sort operator is applied on it. The attribute name parameter is set to 'Temperature'. The sort direction parameter is set to 'increasing'. Then another Sort operator is applied on it. The attribute name parameter is set to 'Humidity' this time. The sort direction parameter is set to 'increasing'. Thus the 'Golf' data set is sorted in ascending order of the 'Humidity' attribute. The example with smallest value of the 'Humidity' attribute becomes the first example and the example with the largest value of the 'Humidity' attribute becomes the last example of the ExampleSet. If some examples have the same value of the 'Humidity' attribute, they are sorted using the 'Temperature' attribute. Where examples have same value of the 'Humidity' attribute then the examples with smaller value of the 'Temperature' attribute precede the examples with higher value of the 'Temperature' attribute. This can be seen in the Results Workspace.