I have a goal where I want to plot sets of tags based on similarity representing each set of tags as a point. The sets can vary in size. An example of two data points could be {'food', 'dog', 'fun'}, {'cat', 'dog', 'sad', 'expensive'}. The similarity of a data point to the rest of the data points should affect it's position relative to the other data points.

Just to clarify, I do not want to analyse the similarity between words in the sets, but want to treat them as tags, meaning the similarity should come from the combination of tags sets have.

Looking into this I have come across a lot of visualizations like this, although i'm not sure if it is necessarily the best option for something like this. Perhaps visualizing this analysis and my data would not even benefit from two dimensions.

Scatter plot

I have read that to do this I need to calculate the "distance" or dissimilarity between each object. Researching this I have found a few different options such as Jaccard index, Gower distance and PCA, but I am not sure if these are applicable to what I am trying to achieve.

I am trying to accomplish this in Python with scikit-learn and pyplot.

I am quite new to statistics and machine learning and would appreciate being sent in the right direction.


closed as unclear what you're asking by Tim Feb 11 at 14:33

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ What exactly is your data? By "similarity in two dimensions" you mean that you have two features and based on them you want to measure similarity? How is the plot related (is it just a scatterplot, it doesn't seem to be related to similarity)? $\endgroup$ – Tim Feb 11 at 14:35
  • $\begingroup$ I have edited my question, hopefully according to your instructions. $\endgroup$ – alo751 Feb 11 at 16:41
  • $\begingroup$ It is still unclear. Say that you calculated Jaccard index between those two "sets", how does this relate to the plot? What would you put on x-axis and y-axis? What kind of help do you need in here? $\endgroup$ – Tim Feb 11 at 16:47
  • $\begingroup$ Perhaps it was a mistake to include the graph if I am not clear on what the axes should be. The reason I was leaning to such a visualization is that when looking at PCA or other dimensionality reduction visualizations similar plots are used. If I understand correctly PCA's resulting axes do not necessarily have any meaning to them but they do express the similarity data points have and where they should fall in relation to each other. I suppose I need more general help in tackling this problem, to find out what approach to use. $\endgroup$ – alo751 Feb 12 at 10:45
  • $\begingroup$ What do you mean by "the similarity should come from the combination of tags sets have"? Number of words in common? Number of words not in common? Length of set? Something about the particular words - or could you substitute letters for words? $\endgroup$ – Peter Flom Feb 12 at 11:01