# Clusterization a Dataset by Category of Another

I have limited knowledge about Machine Learning unfortunately and I want to clusterize a dataset with attributes of another. I have two different data sets which are users and books. Users have different books and books have different categories:

User1 -> book1, book2, book3
User2 -> book1,book3
User3 -> book4, book1

book2 -> Music, Creativity
book3 -> Novel, Classics
book4 -> Photography


I want to get a kind of result such as "Finance lovers" or "Music lovers". What are the techniques/ways that I can apply? I searched the techniques but I all find that related to my issue was this. However this solution is only one part of my issue I believe.

You are not doing clustering, and there is also no suitable data or task here for learning.

What you want to do is categorizarion, probably with a rather simple aggregation statistic.

For every user:

• select all his books
• select all categoies of his books
• return the most frequent book category as user category

By the usual terminology:

• Machine learning requires training data, and you want to transfer this information to unlabeled data.
• Clustering is when you do not know what classes exist.

You have only one kind of data. For ML you need to have training data, and data to predict for. But at the same time, you have book categories - you don't want a clustering algorithm to do something different. A clustering algorithm will yield Clusters "1", "2" and "3". It cannot tell you what makes the cluster special.

Try above approach (there probably is no "tool" or "algorithm" gor that, you should be able to formulate this as SQL query). It's easy to understand, and predictable. Simple wins.

• Your solution contains no ML but statistics and simple&effective. Thanks for the answer. One final question about your technique, what about the rest of the users? Lets say the normal value for the "society" is having %40 Business of whole categories (average) but my user has %30 Business books which is the top category like you said. Is the user still a business lover in this case? – Tugkan Sep 23 '15 at 15:43
• Normalizing by the averages is a reasonable improvement. – Anony-Mousse Sep 23 '15 at 16:08

You could use the book categories instead of the book label for clustering. For example:

These are the categories:
E(Economy)
F(Finance)
M(Music)
N(Novel)
Cr(Creativity),
Cl(Classics)
P(Photography).


Then you can make a vector (B, E, F, M, N, Cr, Cl, P) with the frequency each label appears for each user:

User1 -> (1, 1, 1, 1, 1, 1, 1, 0)
User2 -> (1, 1, 1, 0, 1, 0, 1, 0)
User3 -> (1, 1, 1, 0, 0, 0, 0, 1)


Then you can use just a standard clustering algorithm.