Apply Model (RapidMiner Studio Core)

Synopsis

This operator applies an already learnt or trained model on an ExampleSet.

Description

A model is first trained on an ExampleSet; information related to the ExampleSet is learnt by the model. Then that model can be applied on another ExampleSet usually for prediction. All needed parameters are stored within the model object. It is compulsory that both ExampleSets should have exactly the same number, order, type and role of attributes. If these properties of meta data of ExampleSets are not consistent, it may lead to serious errors. If you want to apply several models in a row; for example you want to apply a few preprocessing models before applying a prediction model; then you may group models. This is possible using the Group Models operator.

Input

  • model (Model)

    This port expects a model. It should be made sure that number, order, type and role of attributes of the ExampleSet on which this model was trained are consistent with the ExampleSet on the unlabeled data input port.

  • unlabelled data (Data Table)

    This port expects an ExampleSet. It should be made sure that number, order, type and role of attributes of this ExampleSet are consistent with ExampleSet on which the model delivered to the model input port was trained.

Output

  • labelled data (Data Table)

    The model that was given as input is applied on the given ExampleSet and the updated ExampleSet is delivered from this port. Some information is added to the input ExampleSet before it is delivered through this output port. For example, when a prediction model is applied on an ExampleSet through Apply Model operator, an attribute with prediction role is added to the ExampleSet. This attribute stores the predicted values of the label attribute using the given model.

  • model (Model)

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

Parameters

  • application_parametersThis parameter models parameters for application (usually not needed). This is an expert parameter. Range: menu
  • create_view If the model applied at the input port supports Views, it is possible to create a View instead of changing the underlying data. Simply select this parameter to enable this option. The transformation that would be normally performed directly on the data will then be computed every time a value is requested and the result is returned without changing the data. Some models do not support Views. Range: boolean

Tutorial Processes

Applying a model

In this Example Process, the 'Golf' data set is loaded by using the Retrieve operator. A classification model is trained on this ExampleSet using the the k-NN operator. This model is then supplied at the model input port of the Apply Model operator. The 'Golf-Testset' data set is loaded using the Retrieve operator and provided at the unlabelled data input port of the Apply Model operator. The Apply Model operator applies the model trained by the k-NN operator on the 'Golf-Testset' to predict the value of the attribute with label role i.e. the 'Play' attribute. The original model is also connected to the results port. Breakpoints are added after both Retrieve operators so that the ExampleSets can be viewed before the application of the model.

When you run the process, first of all you will see the 'Golf' data set. Press the Run button to continue. Now, you will see the 'Golf-Testset' data set. Press the Run button again to see the final output of the process. As you can see in the Results Workspace, an attribute with prediction role is added to the original 'Golf-Testset' data set. This attribute stores values of label (Play) predicted by the model (k-NN classification model). This is why now it is called 'labeled data' instead of 'unlabelled data'.