I am solving a problem where I group answers to a given question into clusters using k-means algorithm. The steps I follow are:
- For every answer I get the corresponding vector. Reduce the vector dimension
- I pass the vectors into sckitlearn kmeans implementation and get clusters as output
Now, as a new requirement I want to include the question as extra context on the clustering. Before this, I was completely ignoring it. For example given the question: What would you take to a picnic? The answers beer and soft drink could be on the same cluster because they are beverages, but on the question: What can you buy for kid anniversary party? They shouldn't be.
So my problem would be, how to modify my algorithm so that the formed clusters are question relevant? Or in other words, how to include information about the question in the data so that the algorithm can create clusters according to this.
I've tried some ideas like vectorising also the question and adding it to every answer vectore to have a new resultant vector on step 1, but it doesn't seem to make a difference.
EDIT: Example
Question: "What would you do during a picnic?"
Answers: "Eat burguer","Drink a beer","Play football","play soccer", "Enjoy a root beer","Swallow a steak","Eat a salad", "Something else"
Clusters that could be formed: ["Eat burguer","Swallow a steak"], ["Drink a beer", "Enjoy a root beer"], ["Play football","play soccer"]