3
$\begingroup$

I am studying classification algorithms using decision tree approach in Python. I would have some questions on this topic, specifically regarding the target (y) in my dataset.

I have a dateset made by 20000 observations and a few fields:

  • Customer
  • recorded date
  • amount
  • status (if married or not)
  • children (if any children in the family)
  • nationality (if American or not)

And so on.

Most of these fields are binary (yes/no). Based on this I would like to determine if this customer is trustworthy or not. As you can see, I have no label about trusting, but I have some initial information: for example the amount. If the amount is 0 or < 0, the customer has no money so he/she can be considered not trusted. Then, I could consider status: if he/she is married, then it could be considered trustworthy, as there could be another salary to take into account. And so on. My doubt are in splitting my dataset, as it asks about y variable. What would it be in this case? I have no explicit target..

$\endgroup$
1
$\begingroup$

When you do not have any target, and you want to label them as trustworthy or not, so here you are using your psychology that when customer is not earning money, or not married, then he/she is a bad customer. But manually labeling the datasets with this psychology may or may not be correct. Because you do not have any target variable to validate your labeling.

Therefore, as @Kappil C has suggested, first you need to categorize your data using some clustering algorithm to understand how your population is divided. It can be trustworth Vs non-trustworthy (2 classes). Or it can be super-trust-worthy, trust-worthy, non-trust-worthy (3 or more classes).

Once these classes are tagged, you are ready to proceed with any Supervised learning algorithm.

enter image description here

As against to this approach, you can proceed with simple rule-based technique also using basic statistics where you will understand each variable individually, and will create multiple rules independently. But again, you need to have target to find confusion matrix rule wise

Example:

People with age > 50 -> Super-trust-worthy

People with age < 18 -> Non-trust-worthy

and these rules will be helpful in streamlining your business.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you so much @Deepak. I have somendoubts regarding how to determine the ‘accuracy’ of the classification since it is an unsupervised Learning algorithm. Should I check values manually or there is another way? $\endgroup$ – Math Jul 3 at 15:06
  • 1
    $\begingroup$ Thanks a lot @Deepak. So if I understood correctly, what I should is considering my dataset ( splitting into train and test?) ; then run the k means clustering to identify clusters (the number will be given by the elbow method or silhouettes method). After that, I will add the corresponding label to my dataset. To test the accuracy, I should run a decision tree or a different supervised learning. In the decision tree I should consider the splitting into labels,’in order to test the accuracy of the model. $\endgroup$ – Math Jul 3 at 15:31
  • 1
    $\begingroup$ you can consider whole data without split for clustering process. "hen run the k means clustering to identify clusters" - yes. "After that, I will add the corresponding label to my dataset." - yes. Now you will divide the datasets into train and test. On training data, lets say you train you Decision tree, and then this trained model will be used to predict the class of test data. Once you get the predicted output, you can use confusion matrix to compare this "Decision tree Predicted Class of test data" Vs "Clustering labeled class to your train data". $\endgroup$ – Deepak Jul 3 at 15:45
  • 1
    $\begingroup$ Now your goal should be reduce the false-positive and true-negatives. "In case the model would not be accurate" - Try changing the hyper-parameters, or use more sophisticated algos like Random forest, XGBoost $\endgroup$ – Deepak Jul 3 at 15:45
  • 1
    $\begingroup$ Thank you so much for your explanation and for going through the steps, Deepak. $\endgroup$ – Math Jul 4 at 9:55
2
$\begingroup$

Use Clustering under unsupervised learning. That will categorize the customer based on similar parameters. You can define the number of cluster you need to form, in you case it is two(trustworthy and not). If there are more features it will be more helpful for the algorithm.

This might help.

https://towardsdatascience.com/an-introduction-to-clustering-algorithms-in-python-123438574097

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you so much for your answer, @kappil. So you would not suggest to use decision tree for this problem, or clusters should be the first step to assign labels/class to my data? $\endgroup$ – Math Jul 3 at 13:02
  • 2
    $\begingroup$ Decision tree comes under supervised learning for which you will need labeled dataset saying the customer is trustworthy or not(in your case). I am not sure of you requirement. Since you do not have the target variable you have to go with unsupervised learning. Probably when after clustering and after applying your domain knowledge you can categorize the customer. In future when you have a rich data with confirmed target variables you can use decision tree and use the model for predicting new customers. $\endgroup$ – kappil c Jul 3 at 13:08
  • 1
    $\begingroup$ Adding more point, for the requirement you are looking for classifying with only the given parameters may not be true for all cases, if you have a strong understanding for the domain you are doing then it is fine, if not the results might not be very accurate. $\endgroup$ – kappil c Jul 3 at 13:12
  • $\begingroup$ Thank you so much @kappil. I will follow your suggestion. Unfortunately I have lots of data but no labels, so as you suggested it will be necessary to go through clustering. I would have a more question: since clustering is an unsupervised Learning, how could I determine if the classification is ‘good’ or ‘bad’, if there are any ‘outliers’ in the different clusters? To determine the number of clusters, what would you suggest? $\endgroup$ – Math Jul 3 at 15:05
  • 1
    $\begingroup$ There are certain metrics that are used for such purposes, you would have to know learn clustering for that. "hands on machine learning with scikit-learn and tensorflow" this is a very good book, this might help you. $\endgroup$ – kappil c Jul 3 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.