Customer Brand Preferences Report

Introduction

Our main objective in this report is to predict the brand of a incomplete survey of 5000 costumers. We will predict the prefered brand of this incomplete survey based on the features of a complete survey of 10000 costumers. On a first approach, we are going to see if our costumers profiles are similar in both survey (complete and incomplete) to see if our model can replicate.

Then, we’ll try several models for resolving classifications problems, suchs as k-NN, svmLinear (linear support vector machine), logistic regression and decision tree models like random forests, gradient boosted trees and c5.0

We’ll choose the model with the best accuracy, that’s to say, the one who predicts more samples correctly and then we’ll use it on our incomplete survey.

Data exploration and preprocessing

The first step is to clean the data and look for patterns and relations between our attributes.

[1] FALSE

There are no missing values and there aren’t any outliers. Furthermore,there are no correlations between the numeric variables.

First we are going to rename our values to make them more readable and understandable.

We are going to discretize the variables of our model to obtain certain knowledge and information about the patterns and trends of the costumers.

Here, we are going to see if the distribution of the completed survey and the incompleted survey are similar.

We can see, the distributions in both datasets are quite similar, which means that a model based on the complete survey used in the incomplete survey should be consistent. Now let’s take a look into the completed survey data.

In these charts, we can observe that this survey was stratified, as every group in each feature is represented equally.

We can observe a clear pattern in the age vs salary scatterplot. Costumers between 20 and 40 years old who have a salary between 46k and 98k tend to buy Acer, and the rest Sony. Those who are between 40 and 60 years old and have a salary between 72k and 124k are also more likely to buy Acer. Finally, those costumers whose age is between 60 and 80 years tendre to buy Acer if their salary is between 20k and 72k. ## Feauture Engineering

We’ll run a gbm model to see the influence of each variable we’ve got, and then do the feature selection.

                                                    var     rel.inf
salary                                           salary 69.43606681
age                                                 age 30.41634520
credit                                           credit  0.09528803
carKia                                           carKia  0.02646322
carNone of the above               carNone of the above  0.02583674
elevelDegree                               elevelDegree  0.00000000
elevelHS                                       elevelHS  0.00000000
elevelLess than HS                   elevelLess than HS  0.00000000
elevelMaster's, Doc, others elevelMaster's, Doc, others  0.00000000
carBuick                                       carBuick  0.00000000
carCadillac                                 carCadillac  0.00000000
carChevrolet                               carChevrolet  0.00000000
carChrysler                                 carChrysler  0.00000000
carDodge                                       carDodge  0.00000000
carFord                                         carFord  0.00000000
carHonda                                       carHonda  0.00000000
carHyundai                                   carHyundai  0.00000000
carJeep                                         carJeep  0.00000000
carLincoln                                   carLincoln  0.00000000
carMazda                                       carMazda  0.00000000
carMercedes Benz                       carMercedes Benz  0.00000000
carMitsubishi                             carMitsubishi  0.00000000
carNissan                                     carNissan  0.00000000
carRam                                           carRam  0.00000000
carSubaru                                     carSubaru  0.00000000
carToyota                                     carToyota  0.00000000
zipcodeEast South Central     zipcodeEast South Central  0.00000000
zipcodeMid-Atlantic                 zipcodeMid-Atlantic  0.00000000
zipcodeMountain                         zipcodeMountain  0.00000000
zipcodeNew England                   zipcodeNew England  0.00000000
zipcodePacific                           zipcodePacific  0.00000000
zipcodeSouth Atlantic             zipcodeSouth Atlantic  0.00000000
zipcodeWest North Central     zipcodeWest North Central  0.00000000
zipcodeWest South Central     zipcodeWest South Central  0.00000000

We’ve seen using the GBM method that the features that have the highest impact are salary and age. We are going to standarize all the numeric values, because we are going to try models as SVM that are based on distances.

Modeling

Now we’ll try the gradient boosted machines, knn, random forest, support vector machine (svm), logistic regresion and the c5.0 models.

note: only 1 unique complexity parameters in default grid. Truncating the grid to 1 .

Here we store the models and its acurracy in a new data set.

     models accuracy
1       gbm    0.921
2       knn    0.911
3        rf    0.903
4      C5.0    0.913
5 svmLinear    0.621
6       glm    0.524

Here we can observe that the best accuracy is provided by the gbm model. The knn, random forest and c5.0 are the models whith the highest accuracy, while the svm and the logistic regression have the lowest accuracy.

Now we are going to make try of the gbm model on the test set to see its performance.

          Reference
Prediction Acer Sony
      Acer  857  101
      Sony   79 1437
      Accuracy          Kappa  AccuracyLower  AccuracyUpper   AccuracyNull 
  9.272433e-01   8.460368e-01   9.162919e-01   9.371698e-01   6.216653e-01 
AccuracyPValue  McnemarPValue 
 1.277857e-271   1.175249e-01 

Results Interpretations

We can observe that distribution of Acer and Sony are very similar in the complete survey and in the incomplete survey. This was expected as the profile of the costumers and its distribution areve very similar,almost equal. So the total survey show us that the prefered brand for our costumers is Sony, as it was expected

Comment Box is loading comments…

2019-07-16