What is correlation?
In statistics, dependence refers to any statistical relationship between two random variables or two sets of data. Correlation refers to any of a broad class of statistical relationships involving dependence.
In laymans terms, correlation is a relationships between data attributes. For a quick refresher, in data mining, a dataset is made up of different attributes. We use these attributes to classify or predict a label. Some attributes have more "meaning" or influence over the label's value. As you can imagine, if you can determine the influence that specific attributes have over your data, you are in a better position to build a classification model because you will know which attributes you should focus on when building your model.
In this example, I will use the kaggle.com Titanic datamining challenge dataset. This post will not uncover any information that is not readily available in the tutorial posted on kaggle.com.
Here are two screenshots. The first screenshot will show you some statistics about the dataset. The second screenshot will show a sample of the data.
Meta data view of the Titanic data mining challenge Training dataset
A data view of the dataset
The correlation matrix
First start by importing the Titanic training dataset into RapidMiner. You can use Read From CSV, Read From Excel, or Read from Database to achieve this step. Next, search for the "Correlation Matrix" operator and drag it onto the process surface. Connect the Titanic training dataset output port to the Correlation Matrix operator's input example port. Your process should look like this.
Now run the process and observe the output.
You are presented with several different result views. The first view will be the Correlation Matrix Attribute Weights view. The Attribute weights view displays the "weight" of each attribute. The purpose of this tutorial is to explain a different view of the Correlation matrix. Click on the Correlation Matrix view. This is a matrix that shows the Correlation Coefficients which is a measure of the strength of the relationship between our attributes. An easy way to get started with the Correlation matrix is to notice that when an attribute intersects with itself, you have a dark blue cell with the value of 1 which represents the strongest possible value. This is because any attribute matched with itself is a perfect correlation. A correlation coefficient value can be positive or negative. A negative value does not necessarily mean there is less of a relationship between the values represented. The larger the coefficient in either direction represents a strong relationship between those two attributes. If we look at the matrix and follow along the top row (survived) we will see the attributes that have the strongest correlation with the label in which we are trying to predict.
Just as the kaggle.com tutorial specifies, the attributes with the strongest correlation with the label (survived) are
sex(0.295), pclass(0.115), and fare(0.66)
Remember that the value as well as the color will help you to visually identify the stronger correlation between attributes.
If you are working with a classification problem, I'm sure you can see how valuable the correlation matrix can be in showing you the relationships between your label and attributes. Such insights let can provide a great start on where to focus your attention when building your classification model.
Thanks for reading and keep your eyes open for my next tutorial!