Python Learner (Python Scripting)

Synopsis

This operator generates a Python model that is compatible with RapidMiner's model interfaces.

Description

The behavior of this operator is defined by a Python script which depending on the operator configuration can be edited by the user.

If the operator is editable, the parameter panel features a set of buttons at the top of the parameter list that allow to edit the declaration (e.g., capabilities and parameter types) and the Python script, as well as to save the configuration as template.

If the operator is not editable, you can check the operator capabilities to learn more about the inputs supported by the preconfigured Python script.

Please note that the model generated by this operator wraps the Python model returned by the Python script. Both training and applying the model requires a compatible Python environment.

Input

  • training set (Data Table)

    The input data which is used to generate the Python model.

Output

  • model (Model)

    The wrapped Python model is delivered from this output port.

  • example set (Data Table)

    The example set that was given as input is passed without changing to the output through this port.

Parameters

  • operator If enabled, this parameter allows to edit the operator declaration (e.g., capabilities and parameter types) and the Python script used to train and apply the Python model. Range: configurable

Tutorial Processes

Classification and regression in a single Python Learner

This example shows how to create a single Python Learner, that supports both classification and regression, and can handle nominal features. In other words, a Python Leaner that behaves very similar to RapidMiner's builtin learners.

The example wraps the popular LightGBM models and uses Scikit-learn's pipeline concept to create a learner that automatically one-hot encodes all non-numeric features and checks the type of the target variable to decide whether to train a classifier of regressor.

Unsupervised learning

This tutorial process shows how to create an unsupervised Python Learner by the example of wrapping Scikit-learn's Isolation Forest. A Scikit-learn pipeline including one-hot encoding is used to support nominal features.