Answers.Body: <p>Any clustering algorithm should work -- the main issue is the similarity or distance metric that determines how similar (or different) two elements are. This is often something like Euclidean distance, but that won't work well with binary data.</p>
  <p>I would suggest using the <a href="https://en.wikipedia.org/wiki/Jaccard_index" rel="nofollow noreferrer">Jaccard Index</a> or <a href="https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient" rel="nofollow noreferrer">Dice Coefficient</a>. These will be suitable for use as a metric when clustering such data.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-05-17T05:47:01.247Z
Answers.Text: Hey Oliver, thanks a lot! I'll try and experiment with using these distance metrics.
Answers.UserDisplayName: user199590
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-05-16T08:06:47.407Z
Answers.LastActivityDate: 2022-05-16T08:06:47.407Z
Answers.UserDisplayName: Oliver Mason
Body: <p>I have a dataset with a lot of binary categorical features and a single continuous target value. I would like to cluster them, but I am not quite sure what to use.</p>
  <p>In the past, I have used DBSCAN for something similar and it worked well, but that dataset also had lots of continuous features.</p>
  <p>Do you have any tips and suggestions?</p>
  <p>Would you suggest matrix factorization and then cluster?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-15T15:59:04.240Z
Comments.Text: By "binary categorical (one-hot encoded)", do you mean that you have $n$ features, and, for each input, only one of them is $1$ and all the others are $0$?
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-15T16:02:34.250Z
Comments.Text: @nbro thanks for the comment! No, I have n features and any combination of 0, 1s among them is possible.
  i.e. if n = 3, I may have, 000 or 010, or 111, etc.
Comments.UserDisplayName: user199590
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-15T16:07:36.710Z
Comments.Text: Ok, then I don't think that's called one-hot encoded. 1-hot encoded is what I described, I think.
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-15T16:08:30.443Z
Comments.Text: @nbro ah, apologies, I meant to convey that the individual features can only be either 0 or 1. I'll edit.
Comments.UserDisplayName: user199590
Tags: <unsupervised-learning><algorithm-request><clustering>
Title: What clustering algorithms work best for datasets with only binary categorical features?
UserDisplayName: user199590
ThreadText: # What clustering algorithms work best for datasets with only binary categorical features?
  
  (Asked by: username_0 on 2022-05-15)
  
  I have a dataset with a lot of binary categorical features and a single continuous target value. I would like to cluster them, but I am not quite sure what to use.
  
  In the past, I have used DBSCAN for something similar and it worked well, but that dataset also had lots of continuous features.
  
  Do you have any tips and suggestions?
  
  Would you suggest matrix factorization and then cluster?
  
  **Tags:** unsupervised-learning, algorithm-request, clustering
  > **Comments:**
  > **username_1**: By "binary categorical (one-hot encoded)", do you mean that you have $n$ features, and, for each input, only one of them is $1$ and all the others are $0$?  
  > **username_0**: @nbro thanks for the comment! No, I have n features and any combination of 0, 1s among them is possible. i.e. if n = 3, I may have, 000 or 010, or 111, etc.  
  > **username_1**: Ok, then I don't think that's called one-hot encoded. 1-hot encoded is what I described, I think.  
  > **username_0**: @nbro ah, apologies, I meant to convey that the individual features can only be either 0 or 1. I'll edit.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-05-16. Score: 1 | Accepted answer
  
  Any clustering algorithm should work -- the main issue is the similarity or distance metric that determines how similar (or different) two elements are. This is often something like Euclidean distance, but that won't work well with binary data.
  
  I would suggest using the [Jaccard Index](https://en.wikipedia.org/wiki/Jaccard_index) or [Dice Coefficient](https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient). These will be suitable for use as a metric when clustering such data.
  
  > **Comments:**
  > **username_0**: Hey Oliver, thanks a lot! I'll try and experiment with using these distance metrics.  
  
  ---
  
  