Hello and welcome back!
In this video we will briefly take a look at data preparation and then we will create a model.
If you want to follow along you can download the data file and import it.
The videos 'Importing data' and 'Data loading process' videos will both show you how it is done.
We will start by retrieving the data from our repository.
Click on the 'data' directory, highlight your customer data and drag it over, like so.
Before we actually build a model we want to inspect our data for issues
and to see if we need to do any further preparation.
So click on the 'output' port of the operator and drag a connection to the 'results' port of the process panel.
Click the port to establish the connection and come over to your 'Run process' button and run it.
We've seen this result before, but let's talk a little bit more about it now to understand,
what we need to do to build a 'decision tree'.
As we talked about before, each row in your data set is called an example in RapidMiner
and each column is called an attribute.
You see the Churn-Attribute here?
It's green - well that means it's a special attribute - it's a 'label'.
But what does 'label' mean?
The term 'Label' is just a fancy name to tell any advanced algorithm, that this is the 'attribute of interest'.
If you have sharp eyes you'll see that there's some question marks in our 'label'.
Those are rows or examples, where we don't know if this person belongs in the 'loyal' bucket or 'churn' bucket.
These maybe new customers that we have just got, and now we want to be able to find out, where do they belong
or - are they 'loyal' or are they 'churn' and if they are 'churn'
we might want to take some preemptive actions to try to keep them.
A lot of times advanced algorithms can't handle missing values.
So what we're going to do today is we're going to filter out all the examples with missing information,
and then we will build a 'decision tree'-model from the prepared data.
And how do we do that?
Well, we'll use one of RapidMiner's advanced ETL - also known as Extract, Transform and Load - operators.
So let's go back to the 'design' view.
Let's search for an operator called 'filter examples'.
Highlight it and drag it over - and when you see the connection get thick - drop it.
One thing you should know, RapidMiner is pretty smart about wiring operators together,
but sometimes you may want to have a little bit more control over it, so feel free to hover over the port -
right click - and then disconnected it, if you don't want it.
In this case we will leave it.
To continue, let's click on 'filter examples' and let's set the parameters of the operator,
to filter out all those examples with missing values.
Navigate to the right to your parameters panel - click on 'Add filters' - and it gives you a nice wizard.
You can see here that it automatically populated 'gender', but we don't want 'gender',
we want to filter on 'churn'.
So pull down this menu, select the 'churn' and hover over to the conditions.
Pull them down - scroll down to 'is not missing'.
So what we're doing here is, we're telling RapidMiner to filter out all the examples
which have a question mark in our churn-attribute.
Let's hit 'ok' and let's hit the 'Run Process' button.
Great - I don't see any more question marks.
So are we ready?
No - we just filtered the example-set, because we saw there were some missing values in
the first few displayed examples of our label.
To make sure we have done the filtering correctly, and there are no red-flags in the other attributes either,
let's look at the statistics RapidMiner has helpfully calculated for us.
Click on statistics - you can see here, that there are zero missing in all the attributes.
Now, we are ready to build a 'decision tree'.
Great, so let's go back to our design view and go back to our operator panel to look for a 'decision tree' modeler.
Highlight it - drag it over and drop it on the connection.
But before we hit 'run process', let's save all our work.
Let's expand the process directory - we see we have '01 import customer data' so let's call this '02 build decision tree'.
Let's save it by highlighting the process directory - right clicking - and select 'store process here'.
And we will give the process the name '02 to build decision tree' and now we're ready to run it.
Ok in this 'decision Tree' we see that the most important variable to split on is 'gender'.
In case you want to know how this first split-attribute is identified by a decision tree algorithm,
then check out the very entertaining, 'decision tree' episode of '5-miuntes with Ingo' on our YouTube channel,
featuring also our 'Chief furry officer'.
But now back to our result review.
We see here that most of our customers are 'loyal' if they are of the gender 'male'.
But what would we expect according to this tree if you would be a new customer - if you are - let's say a female,
named 'Anny', who is 39 years old, and may have last interacted with us a month ago
- let's see how she would be classified according to this tree.
Gender - Anny is 'female' - she's not older than '89' but she is younger than 89,
but then she is older than '30.5' - so she is in this branch.
So she is likely a 'churn'-candidate.
Now in contrast if Anny was younger than '30', and since she has interacted with us only a month ago
we would want to know what payment method she used to predict her next action.
If she used her Credit card we would likely have a loyal customer in her.
The thickness of the colored bar indicates, out of how many examples, the branch is made.
If you want to see some of the numeric information you can look at the 'Description' tab.
Let's click on that and here we see that the branch which we would use to classify our '30-year-old
and credit-card-using Anny' has 87 examples out of which 73 are 'loyal' and 14 are 'churn'.
Congratulations you built and reviewed your first 'decision tree'-model.
Thank you very much for watching!