# Finding similarity between two histogram plots

I have data census(name, sex, age, capital_gain) and I want to plot all possible views (in a histogram) and find the most interesting view based on the distinction to other views.

So, I have to compute the similarity between two histogram plots, for example:

1. Average Capital Gain vs Sex (which computed by aggregate Capital gain to Sex) 1. Average age vs Sex (which computed by aggregate average age to sex) My questions is, what kind of measurement that can be used to check the similarity between those two histogram plots? I consider the features that want to be compared are (x-axis, y-axis, and pattern of the histogram)

I really not sure about distance function that can be used for this case. I know Jaccard distance, but not sure it can be used in this situation or not.

Thank you,

I'm curious what other people will say, but one option is to use KL-divergence. If your two histograms have the same x-axis, you can divide every column by the total count to convert counts to proportions. Then you could treat the histograms as probability mass, and use the KL-divergence. KL-divergence is really a measure of the distance between two probability distributions, but histograms are an approximation of a discrete distribution. You'd pick one of your distributions to be P and one to be Q, then calculate $-\sum_x P(X)\log{\frac{P(X)}{Q(X)}}$ where $x$ is each bin on the x-axis of the histogram. Be aware that this distance metric is directional, meaning you'll get a different answer if you swap P and Q. The reason is that the KL-divergence is a measure of information transfer (like, the information you gain by moving from Q to P), but I think that's irrelevant to your question.