Exchange Roles (RapidMiner Studio Core)


This operator exchanges the roles of two attributes.


The Exchange Roles operator exchanges the roles of the two specified attributes i.e. it assigns the role of the first attribute to the second attribute and vice versa. This can be useful, for example, to exchange the roles of a label with a regular attribute (or vice versa), or a label with a batch attribute, a label with a cluster etc. For more information about roles please study the description of the Set Role operator.


  • example set input (Data Table)

    This input port expects an ExampleSet. It is the output of the Retrieve operator in the attached Example Process. The output of other operators can also be used as input.


  • example set output (Data Table)

    The roles of the specified attributes are exchanged and the resultant ExampleSet is delivered through 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.


  • first_attributeThis parameter specifies the name of the first attribute for the attribute role exchange. Range: string
  • second_attributeThis parameter specifies the name of the second attribute for the attribute role exchange. Range: string

Tutorial Processes

Exchanging roles of attributes of the Golf data set

The 'Golf' data set is loaded using the Retrieve operator. A breakpoint is inserted here so that you can have a look at the ExampleSet. You can see that the roles of the Play and Outlook attributes are label and regular respectively. The Exchange Roles operator is applied on the 'Golf' data set to exchange the roles of these attributes. the first attribute and second attribute parameters are set to 'Play' and 'Outlook' respectively. The resultant ExampleSet can be seen in the Results Workspace. You can see that now the role of the Play attribute is regular and the role of the Outlook attribute is label.