Options

If Statements - Getting Started with the Rapidminer Expression Editor

JessForbesRMJessForbesRM RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 38 RM Data Scientist
edited November 2018 in Knowledge Base

Where can I input a function??

 

Being able to generate attributes based on your own specifications and logic is one of the more important things to get started with in Rapidminer. The expression editor allows for a lot of logical coding, arithmetic, and even text searching.  

 

ExpressionEditorFunction.PNG

 

 

Lets start with a simple if then statement: 

 

Using the Titanic sample data included in your Rapidminer Studio we want to add an attribute called Age_Status.  We will create two categories, minor and adult.  

 

Inside of the Generate Attributes operator you will see "Edit List" this is your list of attributes that you would like to add.  Under "function expressions" is our expression editor.  

 

 

 

 

 

 

 

 

PropedMeta.PNG 

 

 

 

 

 


When you pass information in the generate attribute expression it will actually propagate into the expression editor to allow for easy input of your attribute names.

 

 

 

 

 

 

 

 

SearchForIf.PNG

 

Don't be afraid to search!

Whether it be for inputs or function types, search is your friend.

 

We want an if statement - so lets look for if

Searching for If gives us the logical if statements as well as other pertinent operators.  

 

 

 

 

IfStatement.PNG

Next to each entry inside of our function list there is an (i) icon - selecting it will expand the information that you are interested and will give you an example of how to apply that function to your own operators

 

 

 

IfStatement1.PNG

 

 

For our example we want to make the Age_Status equal to Minor if it is not less than 18.  If it is greater than 18 Age_Status should return Adult.  

 

As you can see the "<" will deliver true if the first term is less than the second. This can be a static comparison or it can be a comparison to an attribute.  For this example we are comparing it to "18"

 

 

 

 

 

 

When you get your function correct syntactically, it will tell you in the info message.  Below is our completed expression.

 

 

IfStatement3.PNG

 

 Learn more about our Generate Attributes operator here: Generate Attributes

Sign In or Register to comment.